raito.plugins.commands.flags module¶
- raito.plugins.commands.flags.description(description)[исходный код]¶
Attach a description to the command handler for use in command registration (e.g.,
raito.register_commands)The description will be shown in the Telegram command list (via
set_my_commands) Supports internationalization via LazyProxy.- Параметры:
description (str | LazyProxy) – A string or LazyProxy representing the description.
- Результат:
A FlagDecorator to be applied to the handler.
- Тип результата:
FlagDecorator
Mark a command handler as hidden from the command list.
Hidden handlers will not be included in Telegram’s slash commands when calling
raito.register_commands.
- raito.plugins.commands.flags.params(**kwargs)[исходный код]¶
Define expected parameters and their types for command parsing.
This acts as a lightweight argument extractor and validator for commands. For example,
@rt.params(user_id=int)will extractuser_id=1234from a command like/ban 1234.Пример
@router.message(filters.Command("ban")) @rt.params(user_id=int) def ban(message: Message, user_id: int): ...