S
S
Sherzod_922020-04-16 13:50:16
PHP
Sherzod_92, 2020-04-16 13:50:16

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 question

Ask a Question

731 491 924 answers to any question