diff --git a/pyrogram/client/filters/filters.py b/pyrogram/client/filters/filters.py index f80127c2..5d892bbe 100644 --- a/pyrogram/client/filters/filters.py +++ b/pyrogram/client/filters/filters.py @@ -211,8 +211,7 @@ class Filters: @staticmethod def command( commands: str or list, - prefix: str or list = "/", - separator: str = " ", + prefixes: str or list = "/", case_sensitive: bool = False ): """Filter commands, i.e.: text messages starting with "/" or any other custom prefix. @@ -224,40 +223,63 @@ class Filters: a command arrives, the command itself and its arguments will be stored in the *command* field of the :obj:`Message`. - prefix (``str`` | ``list``, *optional*): + prefixes (``str`` | ``list``, *optional*): A prefix or a list of prefixes as string the filter should look for. - Defaults to "/" (slash). Examples: ".", "!", ["/", "!", "."]. - Can be None or "" (empty string) to allow commands with no prefix at all. - - separator (``str``, *optional*): - The command arguments separator. Defaults to " " (white space). - Examples: /start first second, /start-first-second, /start.first.second. + Defaults to "/" (slash). Examples: ".", "!", ["/", "!", "."], list(".:!"). + Pass None or "" (empty string) to allow commands with no prefix at all. case_sensitive (``bool``, *optional*): Pass True if you want your command(s) to be case sensitive. Defaults to False. Examples: when True, command="Start" would trigger /Start but not /start. """ + command_re = re.compile(r"([\"'])(.*?)(?