how can I add menu button in telegram bot
Asked Answered
H

4

12

how can I add Menu button in telegram bot using telegraf

menu button like this Menu

Holmic answered 12/6, 2022 at 17:44 Comment(1)
Stack Overflow is a Q&A site; however it doesn’t seem you’ve asked a question. How to AskTargum
H
8

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: "القائمة " },
]);
Holmic answered 15/6, 2022 at 22:20 Comment(0)
V
14

You can achieve this in two ways. Either by

Venue answered 13/6, 2022 at 7:10 Comment(1)
Be sure to restart the telegram app to see the menu appearRania
H
8

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: "القائمة " },
]);
Holmic answered 15/6, 2022 at 22:20 Comment(0)
I
2

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

Inbeing answered 30/4, 2023 at 10:46 Comment(1)
thanks, but we need how to coding this optionHolmic
W
0

open telegram mini app from telegram bot

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

Wiggs answered 25/7 at 2:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.