libbot.pyrogram.classes package¶
Submodules¶
libbot.pyrogram.classes.client module¶
- class libbot.pyrogram.classes.client.PyroClient(name: str = 'bot_client', owner: int | None = None, config: Dict[str, Any] | None = None, config_path: str | Path = PosixPath('config.json'), api_id: int | None = None, api_hash: str | None = None, bot_token: str | None = None, workers: int = 12, locales_root: str | Path | None = None, plugins_root: str = 'plugins', plugins_exclude: List[str] | None = None, sleep_threshold: int = 120, max_concurrent_transmissions: int = 1, commands_source: Dict[str, dict] | None = None, scoped_commands: bool | None = None, i18n_bot_info: bool = False, scheduler: AsyncIOScheduler | BackgroundScheduler | None = None, **kwargs)[source]¶
Bases:
Client
- add_command(command: str) None [source]¶
Add command to the bot’s internal commands list.
- Parameters:
command (str) – Command’s name
- async collect_commands() List[CommandSet] | None [source]¶
Gather list of the bot’s commands.
- Returns:
List of the commands’ sets
- Return type:
List[CommandSet]
- async register_commands(command_sets: List[CommandSet] | None = None) None [source]¶
Register commands stored in bot’s ‘commands’ attribute.
- Parameters:
command_sets (List[CommandSet], optional) – List of command sets. Commands will be parsed from bot’s ‘commands’ attribute if not provided
- async remove_commands(command_sets: List[CommandSet] | None = None) None [source]¶
Remove commands stored in bot’s ‘commands’ attribute.
- Parameters:
command_sets (List[CommandSet], optional) – List of command sets. Commands with scope
pyrogram.types.BotCommandScopeDefault
will be removed if not provided
- async start(register_commands: bool = True, scheduler_start: bool = True) None [source]¶
Start the bot and it’s services.
- Parameters:
register_commands (bool, optional) – Register commands on start. Defaults to True
scheduler_start (bool, optional) – Start the scheduler on start. Defaults to True
- async stop(exit_completely: bool = True, scheduler_shutdown: bool = True, scheduler_wait: bool = True) None [source]¶
Stop the bot and it’s services.
- Parameters:
exit_completely (bool, optional) – Exit the program. Defaults to True
scheduler_shutdown (bool) – Shutdown the scheduler. Defaults to True
scheduler_wait (bool) – Wait for tasks to finish. Defaults to True
libbot.pyrogram.classes.command module¶
libbot.pyrogram.classes.commandset module¶
- class libbot.pyrogram.classes.commandset.CommandSet(commands: ~typing.List[~pyrogram.types.bots_and_keyboards.bot_command.BotCommand], scope: ~pyrogram.types.bots_and_keyboards.bot_command_scope_default.BotCommandScopeDefault | ~pyrogram.types.bots_and_keyboards.bot_command_scope_all_private_chats.BotCommandScopeAllPrivateChats | ~pyrogram.types.bots_and_keyboards.bot_command_scope_all_group_chats.BotCommandScopeAllGroupChats | ~pyrogram.types.bots_and_keyboards.bot_command_scope_all_chat_administrators.BotCommandScopeAllChatAdministrators | ~pyrogram.types.bots_and_keyboards.bot_command_scope_chat.BotCommandScopeChat | ~pyrogram.types.bots_and_keyboards.bot_command_scope_chat_administrators.BotCommandScopeChatAdministrators | ~pyrogram.types.bots_and_keyboards.bot_command_scope_chat_member.BotCommandScopeChatMember = <class 'pyrogram.types.bots_and_keyboards.bot_command_scope_default.BotCommandScopeDefault'>, language_code: str = '')[source]¶
Bases:
object
Command stored in PyroClient’s ‘commands’ attribute
- commands: List[BotCommand]¶
- language_code: str = ''¶
- scope¶
alias of
BotCommandScopeDefault