rubenlagus / TelegramBots

Java library to create bots using Telegram Bots API
https://telegram.me/JavaBotsApi
MIT License
4.8k stars 1.23k forks source link

how to Create a menubutton in the code #1351

Closed hurra2025 closed 7 months ago

hurra2025 commented 7 months ago

i want to create a BotCommand ,how to use SetMyCommands. eg public void registerCommands() { List commands = Arrays.asList( new BotCommand("/start", "start"), new BotCommand("/help", "help")); SetMyCommands setMyCommands = new SetMyCommands(); setMyCommands.setCommands(commands); try { execute(setMyCommands); } catch (TelegramApiException e) { e.printStackTrace(); } }

rubenlagus commented 7 months ago

There are docs for it already: https://rubenlagus.github.io/TelegramBotsDocumentation/lesson-6.html