MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / BotCommand

Class BotCommand

src/telegram/_botcommand.py:28–83  ·  view source on GitHub ↗

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 :attr:`command` and :attr:`description` are equal. Args: command (:obj:`str`): Text of the command; :tg-const:`telegram

Source from the content-addressed store, hash-verified

26
27
28class BotCommand(TelegramObject):
29 """
30 This object represents a bot command.
31
32 Objects of this class are comparable in terms of equality. Two objects of this class are
33 considered equal, if their :attr:`command` and :attr:`description` are equal.
34
35 Args:
36 command (:obj:`str`): Text of the command; :tg-const:`telegram.BotCommand.MIN_COMMAND`-
37 :tg-const:`telegram.BotCommand.MAX_COMMAND` characters. Can contain only lowercase
38 English letters, digits and underscores.
39 description (:obj:`str`): Description of the command;
40 :tg-const:`telegram.BotCommand.MIN_DESCRIPTION`-
41 :tg-const:`telegram.BotCommand.MAX_DESCRIPTION` characters.
42
43 Attributes:
44 command (:obj:`str`): Text of the command; :tg-const:`telegram.BotCommand.MIN_COMMAND`-
45 :tg-const:`telegram.BotCommand.MAX_COMMAND` characters. Can contain only lowercase
46 English letters, digits and underscores.
47 description (:obj:`str`): Description of the command;
48 :tg-const:`telegram.BotCommand.MIN_DESCRIPTION`-
49 :tg-const:`telegram.BotCommand.MAX_DESCRIPTION` characters.
50
51 """
52
53 __slots__ = ("command", "description")
54
55 def __init__(self, command: str, description: str, *, api_kwargs: JSONDict | None = None):
56 super().__init__(api_kwargs=api_kwargs)
57 self.command: str = command
58 self.description: str = description
59
60 self._id_attrs = (self.command, self.description)
61
62 self._freeze()
63
64 MIN_COMMAND: Final[int] = constants.BotCommandLimit.MIN_COMMAND
65 """:const:`telegram.constants.BotCommandLimit.MIN_COMMAND`
66
67 .. versionadded:: 20.0
68 """
69 MAX_COMMAND: Final[int] = constants.BotCommandLimit.MAX_COMMAND
70 """:const:`telegram.constants.BotCommandLimit.MAX_COMMAND`
71
72 .. versionadded:: 20.0
73 """
74 MIN_DESCRIPTION: Final[int] = constants.BotCommandLimit.MIN_DESCRIPTION
75 """:const:`telegram.constants.BotCommandLimit.MIN_DESCRIPTION`
76
77 .. versionadded:: 20.0
78 """
79 MAX_DESCRIPTION: Final[int] = constants.BotCommandLimit.MAX_DESCRIPTION
80 """:const:`telegram.constants.BotCommandLimit.MAX_DESCRIPTION`
81
82 .. versionadded:: 20.0
83 """

Callers 15

set_my_commandsMethod · 0.90
test_equalityMethod · 0.90
test_equalityMethod · 0.90
test_equalityMethod · 0.90
test_equalityMethod · 0.90
test_equalityMethod · 0.90
test_equalityMethod · 0.90
bot_commandFunction · 0.90
test_equalityMethod · 0.90
__init__Method · 0.90
test_equalityMethod · 0.90

Calls

no outgoing calls

Tested by 15

test_equalityMethod · 0.72
test_equalityMethod · 0.72
test_equalityMethod · 0.72
test_equalityMethod · 0.72
test_equalityMethod · 0.72
test_equalityMethod · 0.72
bot_commandFunction · 0.72
test_equalityMethod · 0.72
__init__Method · 0.72
test_equalityMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…