Skip to content

Make filters.command work as expected #1755

@Eldinnie

Description

@Eldinnie

Now filters.text allows messages starting with a /, not excluding bot commands, we need a fast and simpler way to stop those entering filters.text if you want to exclude them.

I propose to change filters.command to the following behavior:

  • invoking filters.command will filter any messages with entity.type='bot_command. Basically a mirror of `filters.entity(['bot_command']) which we can just invoke this way)
  • invoking filters.command(only_start=True) | filters.command(True) (name is open for discussion) filters any messages that start with a bot command.

this will allow for easily using filters.text & ~filters.command(true) to not get any command updates with your text filter.

Optionally we could make filters.command a data_filter and add the found commands to CallbackContextas thecontext.commands` (list). Although maybe that is outside this scope and then should also be added for commandhandler to add.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions