0

I'm now creating a telegram bot, I made the inline_keyboard (With callback data) and I want that when I press the button "Developer" it will change the message, but when I want to check callback_data value and have a response it doesn't do anything

$query = $update['callback_query'];
$queryid = $query['id'];
$queryUserID = $query['from']['id'];
$querydata = $query['data'];

// Query
$tastierainline = 'reply_markup={"inline_keyboard": [[{"text":"Developer","callback_data":"Developer"},{"text":"Top10 ","callback_data":"Top10"}]]}';

if ($querydata == "Developer") {
    editMessage(
        $userID, 
        "Bot developed by @Herossandro and @KiroWasHere",
        $messageIDBot, 
        'reply_markup={inline_keyboard: [[{"text":"Home","callback_data":"Home"}]]}'
    );
}

I expect that the bot modify the message to "Bot developed by @Herossandro and @KiroWasHere" but it doesn't do anything when I press the Developer button (it loads for a while but doesn't do anything)

barbsan
  • 3,418
  • 11
  • 21
  • 28
Herossandro
  • 131
  • 8

1 Answers1

0

1- You forgot the double quotations for the second inline_keyboard

2- Shouldn't you use \"?

$query = $update['callback_query'];
$queryid = $query['id'];
$queryUserID = $query['from']['id'];
$querydata = $query['data'];
// Query
$tastierainline = 'reply_markup={\"inline_keyboard\": 
[[{\"text\":\"Developer\",\"callback_data\":\"Developer\"},{\"text\":\"Top10 
\",\"callback_data\":\"Top10\"}]]}';
if ($querydata == "Developer") {
    editMessage($userID, "Bot developed by @Herossandro and @KiroWasHere", 
        $messageIDBot, 'reply_markup={inline_keyboard: 
        [[{\"text\":\"Home\",\"callback_data\":\"Home\"}]]}');
}
Koorosh
  • 302
  • 1
  • 5
  • 15