From 934091d8ea6d59f9ad510a8edb84fb6af836f010 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Fri, 7 May 2021 13:18:00 +0200 Subject: [PATCH] Fix get_me being called for every command It needs to be called once only --- pyrogram/filters.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pyrogram/filters.py b/pyrogram/filters.py index 9a1b2bdd..d969026b 100644 --- a/pyrogram/filters.py +++ b/pyrogram/filters.py @@ -740,10 +740,15 @@ async def linked_channel_filter(_, __, m: Message): linked_channel = create(linked_channel_filter) """Filter messages that are automatically forwarded from the linked channel to the group chat.""" - # endregion +# region command_filter + +# Used by the command filter below +username = None + + def command(commands: Union[str, List[str]], prefixes: Union[str, List[str]] = "/", case_sensitive: bool = False): """Filter commands, i.e.: text messages starting with "/" or any other custom prefix. @@ -764,10 +769,10 @@ def command(commands: Union[str, List[str]], prefixes: Union[str, List[str]] = " Examples: when True, command="Start" would trigger /Start but not /start. """ command_re = re.compile(r"([\"'])(.*?)(?