raito.utils.filters.command module

class raito.utils.filters.command.RaitoCommand(*values, commands=None, ignore_case=False, magic=None)[исходный код]

Базовые классы: 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
Параметры:
  • values (CommandPatternType)

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

  • ignore_case (bool)

  • magic (MagicFilter | None)

prefix
classmethod extract_command(text)[исходный код]
Параметры:

text (str)

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

CommandObject

update_handler_flags(flags)[исходный код]

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

Параметры:

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

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

None

commands
ignore_case
ignore_mention
magic