1 | <?php |
||
21 | class InlinekeyboardCommand extends UserCommand |
||
22 | { |
||
23 | /**#@+ |
||
24 | * {@inheritdoc} |
||
25 | */ |
||
26 | protected $name = 'Inlinekeyboard'; |
||
27 | protected $description = 'Show inline keyboard'; |
||
28 | protected $usage = '/inlinekeyboard'; |
||
29 | protected $version = '0.0.2'; |
||
30 | /**#@-*/ |
||
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | public function execute() |
||
36 | { |
||
37 | $message = $this->getMessage(); |
||
38 | |||
39 | $inline_keyboard = [ |
||
40 | new InlineKeyboardButton(['text' => 'inline', 'switch_inline_query' => 'true']), |
||
41 | new InlineKeyboardButton(['text' => 'callback', 'callback_data' => 'identifier']), |
||
42 | new InlineKeyboardButton(['text' => 'open url', 'url' => 'https://github.com/akalongman/php-telegram-bot']), |
||
43 | ]; |
||
44 | $data = [ |
||
45 | 'chat_id' => $message->getChat()->getId(), |
||
46 | 'text' => 'inline keyboard', |
||
47 | 'reply_markup' => new InlineKeyboardMarkup(['inline_keyboard' => [$inline_keyboard]]), |
||
48 | ]; |
||
49 | |||
50 | return Request::sendMessage($data); |
||
51 | } |
||
52 | } |
||
53 |