ForcereplyCommand.php 1.12 KB
Newer Older
1
<?php
2
/**
3 4 5 6 7 8
 * This file is part of the TelegramBot package.
 *
 * (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
9
 */
10

11
namespace Longman\TelegramBot\Commands\UserCommands;
MBoretto's avatar
MBoretto committed
12

13 14
use Longman\TelegramBot\Commands\UserCommand;
use Longman\TelegramBot\Request;
MBoretto's avatar
MBoretto committed
15
use Longman\TelegramBot\Entities\ForceReply;
16

17 18 19 20
/**
 * User "/forcereply" command
 */
class ForceReplyCommand extends UserCommand
21
{
22 23 24
    /**#@+
     * {@inheritdoc}
     */
25 26 27
    protected $name = 'forcereply';
    protected $description = 'Force reply with reply markup';
    protected $usage = '/forcereply';
28
    protected $version = '0.0.6';
29
    /**#@-*/
30

31 32 33
    /**
     * {@inheritdoc}
     */
34 35 36 37 38
    public function execute()
    {
        $message = $this->getMessage();
        $chat_id = $message->getChat()->getId();

39 40 41 42 43
        $data = [
            'chat_id'      => $chat_id,
            'text'         => 'Write something:',
            'reply_markup' => new ForceReply(['selective' => false]),
        ];
MBoretto's avatar
MBoretto committed
44

45
        return Request::sendMessage($data);
46 47
    }
}