Handle /me messages properly

This commit is contained in:
git-bruh 2020-12-08 16:12:33 +05:30
parent 6d34130f7f
commit 0815ac170f
No known key found for this signature in database
GPG key ID: E1475C50075ADCE6

13
main.py
View file

@ -246,6 +246,12 @@ class Callbacks(object):
content_dict = event.source.get("content") 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: try:
if content_dict["m.relates_to"]["m.in_reply_to"]["event_id"] in \ if content_dict["m.relates_to"]["m.in_reply_to"]["event_id"] in \
message_store.values(): message_store.values():
@ -253,11 +259,8 @@ class Callbacks(object):
except KeyError: except KeyError:
pass pass
author = event.sender[1:] if content_dict["msgtype"] == "m.emote":
avatar = None message = f"* {author.split(':')[0]} {message}"
homeserver = author.split(":")[-1]
url = "https://matrix.org/_matrix/media/r0/download"
message = await self.process_message(message) message = await self.process_message(message)