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

ForceReplyCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 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\ForceReply;
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.0.6';
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
            'text'         => 'Write something:',
42
            'reply_markup' => new ForceReply(['selective' => false]),
43
        ];
44
45
        return Request::sendMessage($data);
46
    }
47
}
48