Answer the question
In order to leave comments, you need to log in
Callback query not working telegram php?
Callback query doesn't work.
I am using https://github.com/TelegramBot/Api.
public function actionMybigbot(){
$token = '*************************************************';
$bot = new Client($token);
$bot->on(function ($update) use ($bot) {
$message = $update->getMessage();
$text = $message->getText();
$chat_id = $update->getMessage()->getChat()->getId();
$keyboardQuest = [
['text'=>'1-Савол','callback_data'=>'q1'],
['text'=>'2-Савол','callback_data'=>'q2'],
['text'=>'3-Савол','callback_data'=>'q3'],
['text'=>'4-Савол','callback_data'=>'q4'],
['text'=>'5-Савол','callback_data'=>'q5'],
];
switch ($text){
case '/start':
$keyboard = new \TelegramBot\Api\Types\ReplyKeyboardMarkup(array(array("Savollar", "Javoblar")), true,true);
$bot->sendMessage($chat_id, 'awdawd',null,false,null,$keyboard);
break;
case 'Savollar':
$keyboard = new \TelegramBot\Api\Types\Inline\InlineKeyboardMarkup(array($keyboardQuest));
$bot->sendMessage($chat_id, 'Savollardan birini tanlang!',null,false,null,$keyboard);
break;
}
},function($message){ return true;});
$bot->callbackQuery(function ($callbackQuery) use ($bot) {
$bot->sendMessage($chat_id, 'Savollardan birini tanlang!');
});
$bot->run();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question