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\InlineKeyboard;
- use Longman\TelegramBot\Request;
- /**
- * User "/inlinekeyboard" command
- */
- class MenuCommand extends UserCommand
- {
- /**
- * @var string
- */
- protected $name = 'menu';
- /**
- * @var string
- */
- protected $description = 'Inline Keyboard Menu structure';
- /**
- * @var string
- */
- protected $usage = '/menu';
- /**
- * @var string
- */
- protected $version = '0.0.1';
- /**
- * Command execute method
- *
- * @return \Longman\TelegramBot\Entities\ServerResponse
- * @throws \Longman\TelegramBot\Exception\TelegramException
- */
- public function execute()
- {
- $message = $this->getMessage();
- $chat_id = $message->getChat()->getId();
- $inline_keyboard = new InlineKeyboard(
- [
- ['text' => 'Menu1', 'callback_data' => 'menu1'],
- ],
- [
- ['text' => 'Menu2', 'callback_data' => 'menu2'],
- ],[
- ['text' => '[Delete Post]', 'callback_data' => 'del-msg'],
- ]);
- $data = [
- 'chat_id' => $chat_id,
- 'text' => 'Menu',
- 'reply_markup' => $inline_keyboard,
- ];
- return Request::sendMessage($data);
- }
- }
- ?>
Add Comment
Please, Sign In to add comment