rubenlagus / TelegramBots

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

SetMyCommands points to an incorrect telegram api path #1240

Closed vcvitaly closed 1 year ago

vcvitaly commented 1 year ago

Describe the bug SetMyCommands points to an incorrect telegram api path, which leads to:

Caused by: org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException: Error executing org.telegram.telegrambots.meta.api.methods.commands.SetMyCommands query: [404] Not Found
    at org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod.deserializeResponseInternal(PartialBotApiMethod.java:54)
    at org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod.deserializeResponse(PartialBotApiMethod.java:34)
    at org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBoolean.deserializeResponse(BotApiMethodBoolean.java:19)
    at org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBoolean.deserializeResponse(BotApiMethodBoolean.java:14)
    at org.telegram.telegrambots.bots.DefaultAbsSender.sendApiMethod(DefaultAbsSender.java:1115)
    at com.github.vcvitaly.learnwordsusingphrases.service.TelegramBotService.<init>(TelegramBotService.java:75)
    ... 26 common frames omitted

The actual command seems to be setBotCommands, not setMyCommands according to https://core.telegram.org/method/bots.setBotCommands

To Reproduce Steps to reproduce the behavior:

  1. Try to use sendApiMethod(setMyCommands)

Expected behavior Bot commands should be set.

Chase22 commented 1 year ago

You were looking at the wrong API. The method is SetMyCommands https://core.telegram.org/bots/api#setmycommands

This is likely caused by a wrong bot token. How are you initialising your bot?

rubenlagus commented 1 year ago

Agree with @Chase22 , method is correct as per API specs