usernein / pyromod

A monkeypatcher add-on for Pyrogram
https://pyromod.pauxis.dev/
GNU Lesser General Public License v3.0
223 stars 70 forks source link

`TypeError: Client.get_many_listeners_matching_with_identifier_pattern() got an unexpected keyword argument 'match_against_pattern'` #43

Closed kyee-rs closed 10 months ago

kyee-rs commented 10 months ago

Remove the match_against_pattern argument. (Or comment it out till function updates)

Here is the additional info on the issue.

Actual error: Client.get_many_listeners_matching_with_identifier_pattern() got an unexpected keyword argument 'match_against_pattern'

Caused when (user's code):

return await client.stop_listening(
    chat_id=callback_query.message.chat.id,
    user_id=callback_query.from_user.id,
)

Caused by (package's code):

# pyromod/listen/client.py 187:189
listeners = self.get_many_listeners_matching_with_identifier_pattern(
    pattern,
    listener_type, 
    match_against_pattern=True # This arg's realization is absent in self.get_many_listeners_matching_with_identifier_pattern()
)

# Absent argument's position: pyromod/listen/client.py 160:170
    @should_patch()
    def get_many_listeners_matching_with_identifier_pattern(
        self,
        pattern: Identifier,
        listener_type: ListenerTypes, # No match_against_pattern?
    ) -> List[Listener]:
        listeners = []
        for listener in self.listeners[listener_type]:
            if pattern.matches(listener.identifier):
                listeners.append(listener)
        return listeners

Links to the broken code: pyromod/listen/client.py 187:189 pyromod/listen/client.py 160:170