You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$bot->onCommand('start', function (Context $ctx) {
$kb = ['reply_markup' =>
['inline_keyboard' => [[
['callback_data' => '1, 'text' => 'One'],
['callback_data' => '2', 'text' => 'Two']
]], 'resize_keyboard' => true]
];
$ctx->sendMessage("How many item would you to search?", $kb);
});
// This function is called when the returned data is '1' or '2'
$bot->onCbQueryData(['1', '2'], function (Context $ctx) {
$ctx->sendMessage("Ok Thanks!");
});
How can I access the data inside onCbQueryData() function? $ctx->getMessage() return null. I want to know if '1' or '2' is returned.
Thank you for the work.
The text was updated successfully, but these errors were encountered:
Hi, the callback query is returned in $ctx->getCallbackQuery() and not in $ctx->getMessage(). To access the data call $ctx->getCallbackQuery()->getData().
I wrote this code:
How can I access the data inside
onCbQueryData()
function?$ctx->getMessage()
returnnull
. I want to know if '1' or '2' is returned.Thank you for the work.
The text was updated successfully, but these errors were encountered: