9

how can I add Menu button in telegram bot using telegraf

menu button like this Menu

Miloud Mokkedem
  • 432
  • 1
  • 5
  • 14
  • Stack Overflow is a Q&A site; however it doesn’t seem you’ve asked a question. [ask] – esqew Jun 13 '22 at 08:08

3 Answers3

11

You can achieve this in two ways. Either by

Roj
  • 995
  • 1
  • 8
  • 22
6

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: "القائمة " },
]);
Miloud Mokkedem
  • 432
  • 1
  • 5
  • 14
0

For simplicity, you can use BotFather and set it directly from there.

  1. Open BotFather - https://t.me/BotFather
  2. send him the command /setcommands

enter image description here

Phat Tran
  • 3,404
  • 1
  • 19
  • 22