Hide navigation sidebar
Hide table of contents sidebar
PTB has undergone significant changes in v20. Please read the documentation carefully and also check out the transition guide in the wiki.
Back to top
Toggle table of contents sidebar

# BotCommand

class telegram.BotCommand(command, description, *, api_kwargs=None)

  Bases: `telegram.TelegramObject`

  This object represents a bot command.

  Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their `command` and `description` are equal.

  Parameters:

    - command (`str`) – Text of the command; `1`- `32` characters. Can contain only lowercase English letters, digits and underscores.

    - description (`str`) – Description of the command; `1`- `256` characters.

  command

    Text of the command; `1`- `32` characters. Can contain only lowercase English letters, digits and underscores.

    Type:

      `str`

  description

    Description of the command; `1`- `256` characters.

    Type:

      `str`

  Use In

  `telegram.Bot.set_my_commands()`

  MAX_COMMAND = 32

    `telegram.constants.BotCommandLimit.MAX_COMMAND`

    New in version 20.0.

  MAX_DESCRIPTION = 256

    `telegram.constants.BotCommandLimit.MAX_DESCRIPTION`

    New in version 20.0.

  MIN_COMMAND = 1

    `telegram.constants.BotCommandLimit.MIN_COMMAND`

    New in version 20.0.

  MIN_DESCRIPTION = 1

    `telegram.constants.BotCommandLimit.MIN_DESCRIPTION`

    New in version 20.0.