-
-
Notifications
You must be signed in to change notification settings - Fork 187
/
Copy pathMarkdownCommand.php
69 lines (60 loc) · 1.47 KB
/
MarkdownCommand.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PhpTelegramBot\Core\Commands\UserCommands;
use PhpTelegramBot\Core\Commands\UserCommand;
use PhpTelegramBot\Core\Entities\ReplyKeyboardMarkup;
use PhpTelegramBot\Core\Request;
/**
* User "/markdown" command
*
* Print some markdown text.
*/
class MarkdownCommand extends UserCommand
{
/**
* @var string
*/
protected $name = 'markdown';
/**
* @var string
*/
protected $description = 'Print Markdown text';
/**
* @var string
*/
protected $usage = '/markdown';
/**
* @var string
*/
protected $version = '1.0.1';
/**
* Command execute method
*
* @return \PhpTelegramBot\Core\Entities\ServerResponse
* @throws \PhpTelegramBot\Core\Exception\TelegramException
*/
public function execute()
{
$message = $this->getMessage();
$chat_id = $message->getChat()->getId();
$data = [
'chat_id' => $chat_id,
'parse_mode' => 'MARKDOWN',
'text' => '*bold* _italic_ `inline fixed width code`
```
preformatted code block
code block
```
[Best Telegram bot api!!](https://github.com/php-telegram-bot/core)
',
];
return Request::sendMessage($data);
}
}