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

HidekeyboardCommand   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 28
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\Entities\ReplyKeyboardHide;
15
use Longman\TelegramBot\Entities\ReplyKeyboardMarkup;
16
use Longman\TelegramBot\Request;
17
18
/**
19
 * User "/hidekeyboard" command
20
 */
21
class HidekeyboardCommand extends UserCommand
22
{
23
    /**#@+
24
     * {@inheritdoc}
25
     */
26
    protected $name = 'hidekeyboard';
27
    protected $description = 'Hide the custom keyboard';
28
    protected $usage = '/hidekeyboard';
29
    protected $version = '0.0.6';
30
    /**#@-*/
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function execute()
36
    {
37
        $message = $this->getMessage();
38
        $chat_id = $message->getChat()->getId();
39
40
        $data = [
41
            'chat_id'      => $chat_id,
42
            'text'         => 'Keyboard Hidden',
43
            'reply_markup' => new ReplyKeyboardHide(['selective' => false]),
44
        ];
45
46
        return Request::sendMessage($data);
47
    }
48
}
49