From 0815ac170fd5f955d32743abdbf4c63c5448cb22 Mon Sep 17 00:00:00 2001 From: git-bruh Date: Tue, 8 Dec 2020 16:12:33 +0530 Subject: [PATCH] Handle /me messages properly --- main.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 79d9e12..fbdf544 100644 --- a/main.py +++ b/main.py @@ -246,6 +246,12 @@ class Callbacks(object): content_dict = event.source.get("content") + author = event.sender[1:] + avatar = None + + homeserver = author.split(":")[-1] + url = "https://matrix.org/_matrix/media/r0/download" + try: if content_dict["m.relates_to"]["m.in_reply_to"]["event_id"] in \ message_store.values(): @@ -253,11 +259,8 @@ class Callbacks(object): except KeyError: pass - author = event.sender[1:] - avatar = None - - homeserver = author.split(":")[-1] - url = "https://matrix.org/_matrix/media/r0/download" + if content_dict["msgtype"] == "m.emote": + message = f"* {author.split(':')[0]} {message}" message = await self.process_message(message)