inlineKeyboard not working
See original GitHub issueI am trying to implement an inlineKeyboard in my Telegram bot, but keep getting following error:
TelegramError: sendMessage failed: Bad Request: field “inline_keyboard” of the InlineKeyboardMarkup should be an Array of Arrays
I have tried with the example you provided in the docs, but keep getting the same error.
// People who are allowed to manipulate the volume
var ALLOWED_SENDERS = [ 8951984, 5091503, ... ];
bot.command("volumeknob", function (msg, reply, next) {
reply.inlineKeyboard([
{ text: "↑ Turn up", data: JSON.stringify({ type: "volume", direction: true }) },
{ text: "↓ Turn down", data: JSON.stringify({ type: "volume", direction: false }) },
]);
reply.text("Use the buttons below to modify the volume:");
});
bot.callback(function (query, next) {
// Try to parse payload data as JSON. If we succeed, and `type` is set
// to "volume" then the query is for us.
var data;
try {
data = JSON.parse(query.data);
} catch (e) {
return next();
}
if (data.type !== "volume")
return next();
// Check sender is in whitelist
if (ALLOWED_SENDERS.indexOf(query.from.id) === -1)
return query.answer({ text: "Permission denied." });
// Turn volume up or down
if (data.direction) {
system.volumeUp();
query.answer();
} else {
system.volumeDown();
query.answer();
}
});
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
php - Telegram bot inline keyboard callback not working
When I click on the inline keyboard button, nothing responds, why it's happening? Please help me to fix the issues. $update = file_get_contents ......
Read more >Telegram Inline Keyboard commands not working on Android
I was wondering if somebody uses “Inline Keyboard” with Telegram and Android. In general, telegram commands are working for me: service: notify.
Read more >callback not working with version 3.4 · Issue #955 - GitHub
It show nothing when I click on inline keyboard. I have use all this in my custom command handle. use Telegram; use Telegram\Bot\Commands\Command;...
Read more >Problem with inline keyboard buttons : r/TelegramBots - Reddit
Problem with inline keyboard buttons. Helloooo folks. I'm trying to build a telegram bot with the API and Telegraf on the typescript, ...
Read more >Telegram Bot API
This method will not work if an outgoing webhook is set up. ... Inline keyboard attached to the message. login_url buttons are represented...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closing issue, then. By the way, I added the
actions.js
example which also uses inline keyboards.Whooops, again my bad. It was
callback_data
instead ofdata
. I have corrected the example code in the docs, it should work now.I’ve also added a functional
delete_echo.js
example, you can look at it as well.