Skip to content

Commit

Permalink
Thread level chatting for Element Android
Browse files Browse the repository at this point in the history
  • Loading branch information
hibobmaster committed Apr 24, 2024
1 parent 9288f9a commit b9a5884
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,24 @@ async def message_callback(self, room: MatrixRoom, event: RoomMessageText) -> No
)
except Exception as e:
logger.error(e, exe_info=True)
# element android does not have m.mentions, we use another way to make it work
elif "formatted_body" in event_source["content"]:
if (
self.user_id in event_source["content"]["formatted_body"]
and "m.relates_to" not in event_source["content"]
):
try:
asyncio.create_task(
self.thread_chat(
room_id,
reply_to_event_id,
sender_id=sender_id,
thread_root_id=reply_to_event_id,
prompt=content_body,
)
)
except Exception as e:
logger.error(e, exe_info=True)

# thread converstaion
if "m.relates_to" in event_source["content"]:
Expand Down

0 comments on commit b9a5884

Please sign in to comment.