Skip to content

Start & Help Handlers

Miguel Tenorio edited this page Nov 10, 2020 · 1 revision

Every Telegram bot has a start and help commands. For its simplicity, you can look at its implementations to make your own commands.

In this app, the /start and /help commands match. So we'll refer to these two as one: start.

The /start command is designed to behave one way in a private chat and another in a group chat. This is because the list of commands available for the two types of chat are different.

INTRO_PV in line 13 is the main message that is displayed after you send the command to the bot.

Line 23 to 29 describes the list of commands available in a private chat with the bot.

commands_pv = [
        ('start'    , 'Inicia el bot.'),
        ('config'   , 'Configura las opciones de la discución.'),
        ('vote'     , 'Toma parte en la discusión actual.'),
        ('cancel'   , 'Cancela una acción en la configuración o la votación actual si se usa en el grupo.'),
        ('help'     , 'Muestra la ayuda.')
    ]

If you create a new command, you must update the command /start in the chat type for which it is available. The settings for the /start of a chat group are self explanatory in the code: the prefixes G and _group, stands for group.

Clone this wiki locally