remove newline character from event.body

This commit is contained in:
hibobmaster 2023-03-10 12:42:33 +08:00
parent 4c9ec31102
commit a343deecb1
Signed by: bobmaster
GPG key ID: 316B77D7914D713C

2
bot.py
View file

@ -43,6 +43,8 @@ class Bot:
# message_callback event # message_callback event
async def message_callback(self, room: MatrixRoom, event: RoomMessageText) -> None: 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 == '': if self.room_id == '':
room_id = room.room_id room_id = room.room_id
else: else: