deleteMyCommands
Returns: TrueOfficial docs ↗
Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success.
Parameters
A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault.
language_codeStringOptionalA two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands
Returns
On success, True is returned.
GramIO Usage
ts
// Delete all commands globally (all scopes, all languages)
await bot.api.deleteMyCommands({});ts
// Delete commands only for private chats
await bot.api.deleteMyCommands({
scope: { type: "all_private_chats" },
});ts
// Delete Russian-language commands for all group chat admins
await bot.api.deleteMyCommands({
scope: { type: "all_chat_administrators" },
language_code: "ru",
});ts
// Delete commands set for a specific chat
await bot.api.deleteMyCommands({
scope: { type: "chat", chat_id: -1001234567890 },
});Errors
| Code | Error | Cause |
|---|---|---|
| 400 | Bad Request: bad parameter scope | The scope object has an invalid type or is missing required fields (e.g. chat_id for scope chat) |
| 400 | Bad Request: language code is invalid | language_code is not a valid ISO 639-1 two-letter code |
| 429 | Too Many Requests: retry after N | Rate limit hit — check retry_after, use auto-retry plugin |
TIP
Use GramIO's auto-retry plugin to handle 429 errors automatically.
Tips & Gotchas
- All parameters are optional. Calling
deleteMyCommands({})with no arguments clears commands for the default scope (all users, no language filter). This is the most common "reset" use case. - Deletion reveals higher-level commands. After deletion, Telegram falls back to commands registered at a higher scope level (e.g. deleting chat-specific commands reveals group-wide commands). It does not show an empty menu.
- Language code acts as a filter, not a full reset. Passing
language_code: "en"only deletes commands specific to English users — commands with no language code (the "all users" fallback) are unaffected. - Scope must match exactly what was set. You must pass the same scope type you used in
setMyCommands. Deletingall_group_chatswon't touch commands set for a specificchat. - Chat-specific scopes require
chat_id. Scopes likechat,chat_administrators, andchat_memberneed a validchat_id(numeric or@username).
See Also
- setMyCommands — register commands for a scope/language
- getMyCommands — retrieve current commands list
- BotCommandScope — scope object reference