setMyCommands
Set the Bot's command list. Users will see these commands when they type / in the input field.
Request
POST /:token/setmycommands
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| commands | BotCommand[] | Yes | Array of BotCommand objects, each containing a command and description field |
| scope | BotCommandScope | No | Scope of the commands, defaults to all chats |
| language_code | String | No | IETF language code for specifying a language-specific command list |
BotCommand Object
| Field | Type | Description |
|---|---|---|
| command | String | Command text, 1-32 characters, containing only lowercase letters, digits, and underscores |
| description | String | Command description, 1-256 characters |
Response
Returns Boolean true on success.
json
{
"ok": true,
"result": true
}Request Example
json
{
"commands": [
{
"command": "start",
"description": "Start the bot"
},
{
"command": "help",
"description": "Get help information"
},
{
"command": "settings",
"description": "Change settings"
}
]
}Error Codes
| Code | Description |
|---|---|
| 400 | Bad request parameters, e.g. invalid commands format or command contains illegal characters |
| 401 | Invalid or expired token |
| 500 | Internal server error |
