Commit 2e445cc9 authored by Jack'lul's avatar Jack'lul

Improved inline keyboard with callback example

parent 075f0e86
......@@ -110,10 +110,16 @@ class InlinekeyboardCommand extends UserCommand
[
'text' => 'switch to inline',
'switch_inline_query' => 'thumb up'
],
]
];
$inline_keyboard[] = [
[
'text' => 'send callback query',
'callback_data' => 'thumb up'
],
[
'text' => 'send callback query (no alert)',
'callback_data' => 'thumb down'
]
];
......
......@@ -34,10 +34,17 @@ class CallbackqueryCommand extends SystemCommand
$update = $this->getUpdate();
$callback_query = $update->getCallbackQuery();
$callback_query_id = $callback_query->getId();
$callback_data = $callback_query->getData();
$data['callback_query_id'] = $callback_query_id;
$data['text'] = 'Hello world!';
$data['show_alert'] = true;
if ($callback_data == 'thumb up') {
$data['text'] = 'Hello World!';
$data['show_alert'] = true;
} else {
$data['text'] = 'Hello World!';
$data['show_alert'] = false;
}
return Request::answerCallbackQuery($data);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment