According to docs there is a command getBotCommands
- https://core.telegram.org/method/bots.getBotCommands
However none of my request work:
curl -X POST -H 'Content-Type: application/json' https://api.telegram.org/bot${TOKEN}/getBotCommands
returns {"ok":false,"error_code":404,"description":"Not Found"}
The same request to sendmessage
endpoint at least returns {"ok":false,"error_code":400,"description":"Bad Request: message text is empty"}⏎
so I understand that such endpoint exists, however I cannot understand why am I getting such responses from getBotCommands
You're looking at the wrong documentation, your link is for the Telegram Core, you're looking for the Telegram Bot Api Documentation.
Here you will find info about the getMyCommands
endpoint:
getMyCommands
Use this method to get the current list of the bot's commands for the given scope and user language.
Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned.
So the url becomes:
https://api.telegram.org/bot${TOKEN}/getmycommands
Which returns something like the following:
{
"ok": true,
"result": [
{
"command": "foo",
"description": "This is the Foo command"
},
{
"command": "bar",
"description": "Yea this is the Bar variant"
}
]
}