Reputation: 512
how can I add Menu button in telegram bot using telegraf
Upvotes: 14
Views: 42982
Reputation: 61
If you're here to open your mini-app from that button, /setcommands is the wrong way to achieve that.
Here is how you can launch apps from telegram both
/mybots
select your bot
Bot Settings
Menu Button
Then add your url and tittle of your button
Upvotes: 4
Reputation: 3870
For simplicity, you can use BotFather and set it directly from there.
/setcommands
Upvotes: 3
Reputation: 512
I create a menu button by add a new framework " Grammy "
first install grammy : npm install grammy
seconde add this code :
const { Bot } = require("grammy");
const bot = new Bot(BOT_TOKEN); // <-- place your bot token in this string
create list of commands :
bot.api.setMyCommands([
{ command: "start", description: "إبدأ من جديد" },
{ command: "help", description: "طلب مساعدة " },
{ command: "list", description: "القائمة " },
]);
Upvotes: 8
Reputation: 1342
You can achieve this in two ways. Either by
setMyCommands
method, or/setcommands
command.Upvotes: 17