Completed
Push — master ( 203d4a...ef9e39 )
by
unknown
04:46 queued 02:35
created

ForceReplyCommand   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 5
dl 0
loc 27
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\Keyboard;
15
use Longman\TelegramBot\Request;
16
17
/**
18
 * User "/forcereply" command
19
 */
20
class ForceReplyCommand extends UserCommand
21
{
22
    /**#@+
23
     * {@inheritdoc}
24
     */
25
    protected $name = 'forcereply';
26
    protected $description = 'Force reply with reply markup';
27
    protected $usage = '/forcereply';
28
    protected $version = '0.1.0';
29
    /**#@-*/
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function execute()
35
    {
36
        $chat_id = $this->getMessage()->getChat()->getId();
37
38
        $data = [
39
            'chat_id'      => $chat_id,
40
            'text'         => 'Write something:',
41
            'reply_markup' => Keyboard::forceReply(),
42
        ];
43
44
        return Request::sendMessage($data);
45
    }
46
}
47