Skip to main content
TheDevsTheDevs
ArticleTechnical Reference

Telegram Bot Commands List: Complete Guide

A comprehensive reference for Telegram bot commands, covering BotFather setup, custom slash commands, and group admin controls to help you manage and build bots effectively.

By TheDevsAugust 15, 20266 min read1199 words

A Telegram bot commands list is a predefined set of slash commands (e.g., /help, /settings) that users can interact with via the Telegram client's UI. These commands are registered using BotFather via the /setcommands prompt or programmatically through the Telegram Bot API's setMyCommands method. Defining a clear command list enhances user experience by providing autocomplete suggestions and a structured way to navigate bot functionality.

Essential BotFather Commands for Configuration

BotFather is the official Telegram bot used to create and manage other bots. Before writing custom code, developers must interact with BotFather to generate an API token and configure the foundational telegram bot commands list. This establishes the baseline commands visible in the Telegram app menu.

Using BotFather ensures your bot is properly registered and has a default set of commands available even before you write any backend logic.

BotFather CommandDescription
/newbotCreates a new bot and returns an API token.
/setcommandsManually defines the list of commands for the bot UI.
/tokenRetrieves the API token for an existing bot.
/setdescriptionSets the bot description shown in the empty chat screen.
/setuserpicUpdates the bot's profile picture.
/revokeRevokes the current API token and generates a new one for security.

Setting Custom Slash Commands via the Telegram Bot API

While BotFather provides a static way to set commands, dynamic applications require programmatic control. The Telegram Bot API allows developers to update the telegram bot commands list dynamically using the setMyCommands method. This is particularly useful when a bot's available commands change based on user state or application updates.

The method accepts an array of BotCommand objects, each containing a command (string without the leading slash) and a description. This ensures the UI remains synchronized with your backend capabilities.

  1. 1Construct an array of BotCommand objects containing the command name and a short description.
  2. 2Make an HTTP POST request to https://api.telegram.org/bot<token>/setMyCommands.
  3. 3Include the commands array in the JSON payload.
  4. 4Verify the HTTP response returns true in the result field, indicating the UI has been updated.

Use the deleteMyCommands method to clear the existing command list before pushing a new one to avoid orphaned commands in the UI.

Implementing Group Admin Commands

For bots operating in group chats, admin commands are essential for moderation and group management. These commands typically require specific administrative privileges, which the bot must check before executing. To restrict access, the bot should query the getChatMember method to verify if the user issuing the command has administrator rights.

Defining these commands separately from standard user commands prevents clutter and ensures only authorized personnel can trigger sensitive actions.

  • /ban - Restricts a user from the group permanently.
  • /unban - Lifts a previously placed ban on a user.
  • /mute - Revokes a user's permission to send messages temporarily.
  • /promote - Grants administrative privileges to a standard user.
  • /pin - Pins a specific message to the top of the group chat.

Always implement permission checks server-side. Never rely on client-side UI hiding to secure admin commands.

Scoping Commands for Different Chat Contexts

A highly effective telegram bot commands list strategy involves context-aware command scoping. The setMyCommands method accepts an optional scope parameter, allowing developers to display different commands to different users within the same bot.

For example, a standard user might see /help and /start, while a group administrator sees /ban and /promote. This granular control significantly improves the user experience by only showing relevant actions.

BotCommandScope TypeDescription
BotCommandScopeDefaultDefault commands for all users unless overridden.
BotCommandScopeAllPrivateChatsCommands shown only in private 1-on-1 chats.
BotCommandScopeAllGroupAdministratorsCommands shown exclusively to group admins.
BotCommandScopeChatCommands specific to a single chat (requires chat_id).
BotCommandScopeChatMemberCommands specific to a single user in a specific chat.

Best Practices for Designing Bot Command UX

Designing an intuitive telegram bot commands list requires adherence to Telegram's UI constraints and user expectations. Commands should be concise, lowercase, and easy to type. Avoid using complex arguments in the command itself; instead, prompt the user for arguments via inline keyboards or subsequent messages.

Furthermore, always provide a comprehensive /help command that explains what each command does. This serves as a fallback for users who are unfamiliar with the bot's capabilities.

  • Use lowercase letters and numbers only; avoid underscores or hyphens unless necessary.
  • Keep command names under 32 characters.
  • Limit the total number of commands to 100 to prevent UI clutter.
  • Always include a /start and /help command for onboarding and discovery.
  • Provide clear, actionable descriptions under 256 characters for each command.

Conclusion

Building a robust Telegram bot requires more than just handling incoming messages; it demands a well-structured command interface that guides the user. By leveraging BotFather for static configuration and the setMyCommands API for dynamic, scoped command lists, developers can create highly intuitive bot experiences. If you need help architecting a scalable Telegram bot or integrating complex backend logic, TheDevs offers expert software development services to bring your bot ideas to life.

Frequently asked questions

How do I find the telegram bot commands list for a specific bot?

To view a bot's commands, open the chat with the bot in Telegram and tap the menu icon (or slash '/' button) in the message input field. This will display the active telegram bot commands list registered by the developer. If no commands appear, the bot owner hasn't configured them via BotFather or the API.

Why is my telegram bot commands list not showing up in the app?

If your telegram bot commands list isn't appearing, ensure you have used the /setcommands prompt in BotFather or the setMyCommands API method correctly. Commands must start with a slash and contain no spaces. Also, users may need to restart the Telegram app or clear cache to refresh the bot's command menu.

Can I create a localized telegram bot commands list for different languages?

Yes, using the Telegram Bot API, you can create a localized telegram bot commands list by utilizing the setMyCommands method with the language_code parameter. This allows your bot to display specific commands in the user's interface based on their client language settings, improving the experience for international users.

Is there a limit to how many commands I can add to a telegram bot commands list?

Yes, Telegram limits each telegram bot commands list to a maximum of 100 commands per scope. Scopes can be default, for specific chats, or for chat administrators. If you need more commands, you should use inline buttons, nested menus, or text-based navigation within the bot's interface to guide users.

What is the difference between default and admin scopes in a telegram bot commands list?

In a telegram bot commands list, default commands are visible to all users interacting with the bot. Admin-scoped commands are only visible to chat administrators who have the necessary permissions to manage the group. This is configured via the Bot API's BotCommandScopeChatAdministrators to hide standard user commands from admins if needed.

How do I delete a telegram bot commands list completely?

To delete a telegram bot commands list, you can use the deleteMyCommands method in the Telegram Bot API. If you set them manually using BotFather, you cannot directly delete them through the chat interface; you must overwrite them or use the API method to clear the existing command list from the bot's profile.

Related resources

Build it with TheDevs

Post what you want built and TheDevs starts your project — any tech work, one team.