Skip to content

Commit

Permalink
Improving stop_listening and its bound methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Cezar Pauxis committed Jan 20, 2023
1 parent d99d4cb commit 5a54eb5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pyromod/listen/listen.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,14 @@ def match_identifier(pattern, identifier):

@patchable
def stop_listening(
self, data: tuple, listener_type: ListenerTypes = ListenerTypes.MESSAGE
self,
data: Optional[tuple] = None,
listener_type: ListenerTypes = ListenerTypes.MESSAGE,
identifier_pattern: Optional[tuple] = None,
):
listener, identifier = self.match_listener(data, listener_type)
listener, identifier = self.match_listener(
data, listener_type, identifier_pattern
)

if not listener:
return
Expand Down Expand Up @@ -320,7 +325,7 @@ def ask(self, text, *args, **kwargs):
@patchable
def stop_listening(self, *args, **kwargs):
return self._client.stop_listening(
(self.id, None, None), *args, **kwargs
*args, identifier_pattern=(self.id, None, None), **kwargs
)


Expand All @@ -339,5 +344,5 @@ def ask(self, text, *args, **kwargs):
@patchable
def stop_listening(self, *args, **kwargs):
return self._client.stop_listening(
(None, self.id, None), *args, **kwargs
*args, identifier_pattern=(None, self.id, None), **kwargs
)

0 comments on commit 5a54eb5

Please sign in to comment.