Advertisement
Guest User

Untitled

a guest
Feb 7th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.67 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * This file is part of the TelegramBot package.
  5.  *
  6.  * (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
  7.  *
  8.  * For the full copyright and license information, please view the LICENSE
  9.  * file that was distributed with this source code.
  10.  */
  11.  
  12. namespace Longman\TelegramBot\Commands\UserCommands;
  13.  
  14. use Longman\TelegramBot\Commands\UserCommand;
  15. use Longman\TelegramBot\Entities\Keyboard;
  16. use Longman\TelegramBot\Entities\ServerResponse;
  17. use Longman\TelegramBot\Exception\TelegramException;
  18. use Longman\TelegramBot\Request;
  19.  
  20. /**
  21.  * Start command
  22.  */
  23. class StartCommand extends UserCommand
  24. {
  25.     /**
  26.      * @var string
  27.      */
  28.     protected $name = 'start';
  29.  
  30.     /**
  31.      * @var string
  32.      */
  33.     protected $description = 'Start command';
  34.  
  35.     /**
  36.      * @var string
  37.      */
  38.     protected $usage = '/start';
  39.  
  40.     /**
  41.      * @var string
  42.      */
  43.     protected $version = '1.1.0';
  44.  
  45.     /**
  46.      * Command execute method
  47.      *
  48.      * @return ServerResponse
  49.      * @throws TelegramException
  50.      */
  51.     public function execute()
  52.     {
  53.         $message = $this->getMessage();
  54.         $chat_id = $message->getChat()->getId();
  55.  
  56.  
  57.         $keyboard = new Keyboard(
  58.             ['text' => 'посмотреть товары'],
  59.             ['мои заказы', 'поддержка']
  60.         );
  61.  
  62.  
  63.  
  64.         $keyboard->setResizeKeyboard(true)->setOneTimeKeyboard(true)->setSelective(false);
  65.  
  66.         $data = [
  67.             'chat_id'  => $chat_id,
  68.             'text'    => 'Добро пожаловать в магазин',
  69.             'reply_markup' => $keyboard,
  70.         ];
  71.  
  72.      //   return Request::sendMessage($data);
  73.  
  74.  
  75.     }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement