We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c907bb3 commit 498f299Copy full SHA for 498f299
1 file changed
whatsapp_chatbot_python/filters.py
@@ -76,8 +76,12 @@ def check_event(self, notification: "Notification") -> bool:
76
77
class RegExpFilter(AbstractFilter):
78
def __init__(self, pattern: str, flags: Union[RegexFlag, int] = 0):
79
- self.pattern = pattern
80
- self.flags = flags
+ if isinstance(pattern, str):
+ self.pattern = pattern
81
+ self.flags = flags
82
+ elif isinstance(pattern, tuple):
83
+ if len(pattern) == 2:
84
+ self.pattern, self.flags = pattern
85
86
def check_event(self, notification: "Notification") -> bool:
87
text_message = notification.message_text
0 commit comments