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

raito.plugins.commands.flags.hidden(func)[исходный код]

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.

Параметры:

func (Callable) – The command handler to mark as hidden.

Результат:

The wrapped handler.

Тип результата:

Callable[[…], Any]

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 extract user_id=1234 from a command like /ban 1234.

Пример

@router.message(filters.Command("ban"))
@rt.params(user_id=int)
def ban(message: Message, user_id: int):
    ...
Параметры:

kwargs (type[str | int | bool | float]) – A mapping of parameter names to their expected types.

Результат:

A FlagDecorator to be applied to the handler with param data.

Тип результата:

FlagDecorator