tucnak / telebot

Telebot is a Telegram bot framework in Go.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: How to create default menu button?

jokaorgua opened this issue · comments

Hello.

Could you please help how to dynamically create menu button for the bot during the bot startup? (I can achieve that using BotFather menu - Edit bot - Commands) but I want to do that dynamically from my code.

Thanks in advance.

If anyone will get here

the following code automatically creates a menu button. Make sure you are passing array of commands, not just commands one by one

testCommand := tele.Command{Text: "/test1", Description: "test1"}
commands := []tele.Command{testCommand}

err := b.SetCommands(commands)