raito.utils.filters.command module

class raito.utils.filters.command.RaitoCommand(*values, commands=None, ignore_case=False, magic=None)[source]

Bases: Command

A filter for Raito bot commands.

This class filters messages that match the Raito command format: “.rt <command> [arguments]”

The filter matches commands exactly and optionally allows additional arguments. Commands are case-sensitive and must match the prefix “.rt” followed by one of the specified command strings.

Example:

@router.message(RaitoCommand("test"))
async def test(message: Message):
    # Handles messages like:
    # ".rt test"
    # ".rt test foo bar 123"
    pass
Parameters:
  • values (CommandPatternType)

  • commands (Sequence[CommandPatternType] | CommandPatternType | None)

  • ignore_case (bool)

  • magic (MagicFilter | None)

prefix
classmethod extract_command(text)[source]
Parameters:

text (str)

Return type:

CommandObject

update_handler_flags(flags)[source]

Also if you want to extend handler flags with using this filter you should implement this method

Parameters:

flags (dict[str, Any]) – existing flags, can be updated directly

Return type:

None

commands
ignore_case
ignore_mention
magic