raito.plugins.commands.flags moduleยถ

raito.plugins.commands.flags.description(description)[source]ยถ

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.

Parameters:

description (str | LazyProxy) โ€“ A string or LazyProxy representing the description.

Returns:

A FlagDecorator to be applied to the handler.

Return type:

FlagDecorator

raito.plugins.commands.flags.hidden(func)[source]ยถ

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.

Parameters:

func (Callable) โ€“ The command handler to mark as hidden.

Returns:

The wrapped handler.

Return type:

Callable[[โ€ฆ], Any]

raito.plugins.commands.flags.params(**kwargs)[source]ยถ

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.

Example

@router.message(filters.Command("ban"))
@rt.params(user_id=int)
def ban(message: Message, user_id: int):
    ...
Parameters:

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

Returns:

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

Return type:

FlagDecorator