Completed
Pull Request — develop (#288)
by Armando
03:32
created

MarkdownCommand   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 33
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the TelegramBot package.
4
 *
5
 * (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Longman\TelegramBot\Commands\UserCommands;
12
13
use Longman\TelegramBot\Commands\UserCommand;
14
use Longman\TelegramBot\Request;
15
use Longman\TelegramBot\Entities\ReplyKeyboardMarkup;
16
17
/**
18
 * User "/markdown" command
19
 */
20
class MarkdownCommand extends UserCommand
21
{
22
    /**#@+
23
     * {@inheritdoc}
24
     */
25
    protected $name = 'markdown';
26
    protected $description = 'Print Markdown tesxt';
27
    protected $usage = '/markdown';
28
    protected $version = '1.0.1';
29
    /**#@-*/
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function execute()
35
    {
36
        $message = $this->getMessage();
37
        $chat_id = $message->getChat()->getId();
38
39
        $data = [
40
            'chat_id'    => $chat_id,
41
            'parse_mode' => 'MARKDOWN',
42
            'text'       => '*bold* _italic_ `inline fixed width code`
43
```
44
preformatted code block
45
code block
46
```
47
[Best Telegram bot api!!](https://github.com/akalongman/php-telegram-bot)
48
',
49
        ];
50
51
        return Request::sendMessage($data);
52
    }
53
}
54