Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * 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.
- */
- namespace Longman\TelegramBot\Commands\UserCommands;
- use Longman\TelegramBot\Commands\UserCommand;
- use Longman\TelegramBot\Entities\Keyboard;
- use Longman\TelegramBot\Entities\ServerResponse;
- use Longman\TelegramBot\Exception\TelegramException;
- use Longman\TelegramBot\Request;
- /**
- * Start command
- */
- class StartCommand extends UserCommand
- {
- /**
- * @var string
- */
- protected $name = 'start';
- /**
- * @var string
- */
- protected $description = 'Start command';
- /**
- * @var string
- */
- protected $usage = '/start';
- /**
- * @var string
- */
- protected $version = '1.1.0';
- /**
- * Command execute method
- *
- * @return ServerResponse
- * @throws TelegramException
- */
- public function execute()
- {
- $message = $this->getMessage();
- $chat_id = $message->getChat()->getId();
- $keyboard = new Keyboard(
- ['text' => 'посмотреть товары'],
- ['мои заказы', 'поддержка']
- );
- $keyboard->setResizeKeyboard(true)->setOneTimeKeyboard(true)->setSelective(false);
- $data = [
- 'chat_id' => $chat_id,
- 'text' => 'Добро пожаловать в магазин',
- 'reply_markup' => $keyboard,
- ];
- // return Request::sendMessage($data);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement