From a343deecb12a4f51387b6abac353f2d32f3c7974 Mon Sep 17 00:00:00 2001 From: hibobmaster Date: Fri, 10 Mar 2023 12:42:33 +0800 Subject: [PATCH] remove newline character from event.body --- bot.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bot.py b/bot.py index 77c6d43..b14f69b 100644 --- a/bot.py +++ b/bot.py @@ -43,6 +43,8 @@ class Bot: # message_callback event async def message_callback(self, room: MatrixRoom, event: RoomMessageText) -> None: + # remove newline character from event.body + event.body = re.sub("\r\n|\r|\n", " ", event.body) if self.room_id == '': room_id = room.room_id else: