{
  "id": 1522609,
  "title": "How to Add a Command Menu to a Telegram Bot with Python",
  "url": "https://urgent.news/2026/08/17/how-to-add-a-command-menu-to-a-telegram-bot-with-python",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-17T17:07:55.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/telegram_bot_notes/how-to-add-a-command-menu-to-a-telegram-bot-with-python-990"
  },
  "original_language": "en",
  "account": "Registering a command menu in Telegram allows users to access a list of available commands without having to remember each one. In this tutorial, we will add three command handlers - /start, /help, and /status - and register them through the Bot API. These handlers will display different responses when called.\n\nFirst, we create a file called bot.py and import necessary libraries. The bot.py file will contain the code for our command handlers. We import os to access environment variables, telegram modules for updates and command handling, and python-telegram-bot specific classes.\n\nNext, we define our command handlers as async functions. The start function welcomes the user and prompts them to use /help to view available commands. The help_command function lists all available commands: /start, /help, and /status. Finally, the status function informs the user that the service is running normally.\n\nIn the main function, we retrieve the bot token from the environment variable TELEGRAM_BOT_TOKEN. We use this token to initialize the Application object, which handles incoming updates and messages. We then add the command handlers to the application using CommandHandler, specifying the command name and corresponding function.\n\nFinally, we run the application in polling mode, which continuously checks for new updates and messages. When executed, the bot should respond to /start, /help, and /status commands. However, the command menu may still appear empty. To fix this, we need to register the commands using BotFather.",
  "summary": "A Telegram bot can recognize commands without displaying them in the client. However, users should not have to memorize every available command. Registering a command menu lets Telegram show a list when someone taps the menu button or types / . In this tutorial, we will create /start , /help , and /status handlers, register them through the Bot API, and display different command menus in private…",
  "key_points": [
    "Create bot.py file with necessary libraries",
    "Define async command handlers: start, helpcommand, status",
    "Retrieve bot token from environment variable TELEGRAMBOTTOKEN"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}