telegram-bot-api
telegram-bot-api copied to clipboard
How to create main bot menu

How I can set bot menu. I can't find example.
Thank you!
cfg := tgbotapi.NewSetMyCommands(
tgbotapi.BotCommand{
Command: "/test",
Description: "test command",
},
)
_, _ = b.api.Request(cfg)
_, err = b.api.Request(tgbotapi.SetChatMenuButtonConfig{
ChatID: {CHAT_ID},
MenuButton: &tgbotapi.MenuButton{
Type: "default",
},
})
Is it outdated?
I'd like to know too )
@code-by Yes, I suppose, I just registered my commands and got the menu button automatically
here's how the updated code looks like.
...
bot, err := tgbotapi.NewBotAPI(token)
if err != nil {
log.Panic(err)
}
cmdCfg := tgbotapi.NewSetMyCommands(
tgbotapi.BotCommand{
Command: "start",
Description: "start",
},
tgbotapi.BotCommand{
Command: "help",
Description: "help",
},
)
bot.Send(cmdCfg)
...
restart telegram app and it works