Skip to content

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

scopeBotCommandScopeOptional
A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault.
language_codeStringOptional
A 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

CodeErrorCause
400Bad Request: bad parameter scopeThe scope object has an invalid type or is missing required fields (e.g. chat_id for scope chat)
400Bad Request: language code is invalidlanguage_code is not a valid ISO 639-1 two-letter code
429Too Many Requests: retry after NRate 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. Deleting all_group_chats won't touch commands set for a specific chat.
  • Chat-specific scopes require chat_id. Scopes like chat, chat_administrators, and chat_member need a valid chat_id (numeric or @username).

See Also