BotCommandScope

class telegram.BotCommandScope(type, *, api_kwargs=None)[source]

Bases: telegram.TelegramObject

Base class for objects that represent the scope to which bot commands are applied. Currently, the following 7 scopes are supported:

Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their type is equal. For subclasses with additional attributes, the notion of equality is overridden.

Note

Please see the official docs on how Telegram determines which commands to display.

Added in version 13.7.

Parameters:

type (str) – Scope type.

type[source]

Scope type.

Type:

str

ALL_CHAT_ADMINISTRATORS = 'all_chat_administrators'[source]

telegram.constants.BotCommandScopeType.ALL_CHAT_ADMINISTRATORS

ALL_GROUP_CHATS = 'all_group_chats'[source]

telegram.constants.BotCommandScopeType.ALL_GROUP_CHATS

ALL_PRIVATE_CHATS = 'all_private_chats'[source]

telegram.constants.BotCommandScopeType.ALL_PRIVATE_CHATS

CHAT = 'chat'[source]

telegram.constants.BotCommandScopeType.CHAT

CHAT_ADMINISTRATORS = 'chat_administrators'[source]

telegram.constants.BotCommandScopeType.CHAT_ADMINISTRATORS

CHAT_MEMBER = 'chat_member'[source]

telegram.constants.BotCommandScopeType.CHAT_MEMBER

DEFAULT = 'default'[source]

telegram.constants.BotCommandScopeType.DEFAULT

classmethod de_json(data, bot=None)[source]

Converts JSON data to the appropriate BotCommandScope object, i.e. takes care of selecting the correct subclass.

Parameters:
  • data (Dict[str, …]) – The JSON data.

  • bot (telegram.Bot, optional) –

    The bot associated with this object. Defaults to None, in which case shortcut methods will not be available.

    Changed in version 21.4: bot is now optional and defaults to None

Returns:

The Telegram object.