From 0d0507d6499b32f6ce77fdd36ae023ee4d8d2b50 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Fri, 14 Apr 2023 14:21:39 +0200 Subject: [PATCH] regex work --- matrix_pygmalion_bot/core.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/matrix_pygmalion_bot/core.py b/matrix_pygmalion_bot/core.py index 0749ee2..67678ee 100644 --- a/matrix_pygmalion_bot/core.py +++ b/matrix_pygmalion_bot/core.py @@ -106,8 +106,8 @@ class Callbacks(object): print(event) await self.bot.send_message(self.client, room.room_id, "Hello World!") return - elif re.search("(?s)^!image(?P[0-9])?(\s(?P.*))?$", event.body): - m = re.search("(?s)^!image(?P[0-9])?(\s(?P.*))?$", event.body) + elif re.search("(?s)^!image(?P[0-9])?(\s(?P.*))?$", event.body, flags=re.DOTALL): + m = re.search("(?s)^!image(?P[0-9])?(\s(?P.*))?$", event.body, flags=re.DOTALL) if m['num']: num = int(m['num']) else: @@ -233,7 +233,7 @@ class Callbacks(object): return # Other commands - if re.search("^(?=.*\bsend\b)(?=.*\bpicture\b).*$", event.body): + if re.search("^(?=.*\bsend\b)(?=.*\bpicture\b).*$", event.body, flags=re.IGNORECASE): # send, mail, drop, snap picture, photo, image, portrait pass