StartCommand.php 1.02 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\SystemCommands;
12

13
use Longman\TelegramBot\Commands\SystemCommand;
14
use Longman\TelegramBot\Request;
15

16 17 18
/**
 * Start command
 */
19
class StartCommand extends SystemCommand
20
{
21 22
    /**#@+
     * {@inheritdoc}
23
     */
24 25
    protected $name = 'start';
    protected $description = 'Start command';
26
    protected $usage = '/start';
27
    protected $version = '1.0.1';
28
    /**#@-*/
29

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

        $chat_id = $message->getChat()->getId();
38
        $text = 'Hi there!' . "\n" . 'Type /help to see all commands!';
39

40 41 42 43
        $data = [
            'chat_id' => $chat_id,
            'text'    => $text,
        ];
44

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