From d5b4af1f0222982b2d94ab2b66d6720b192fca66 Mon Sep 17 00:00:00 2001 From: saces Date: Mon, 13 Apr 2026 22:12:32 +0200 Subject: [PATCH] bot: add reply thread/notice helper --- mxsmal/src/mxsmal/bot.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/mxsmal/src/mxsmal/bot.py b/mxsmal/src/mxsmal/bot.py index 9775b79..b5b5347 100644 --- a/mxsmal/src/mxsmal/bot.py +++ b/mxsmal/src/mxsmal/bot.py @@ -39,6 +39,29 @@ class SMALBot(SMALApp): data["content"]["m.mentions"]["user_ids"] = [ mxid, ] + data["content"]["m.relates_to"] = {"m.in_reply_to": {"event_id": msgid}} + + await self._sendmessage(data) + + async def sendmessagestartthread(self, roomid, msgid, mxid, text): + data = {} + data["roomid"] = roomid + data["content"] = {} + data["content"]["body"] = text + data["content"]["msgtype"] = "m.text" + data["content"]["m.mentions"] = {} + data["content"]["m.mentions"]["user_ids"] = [ + mxid, + ] + data["content"]["m.relates_to"] = {"rel_type": "m.thread", "event_id": msgid} + await self._sendmessage(data) + + async def sendnoticereply(self, roomid, msgid, mxid, text): + data = {} + data["roomid"] = roomid + data["content"] = {} + data["content"]["body"] = text + data["content"]["msgtype"] = "m.notice" data["content"]["m.relates_to"] = {} data["content"]["m.relates_to"]["m.in_reply_to"] = {} data["content"]["m.relates_to"]["m.in_reply_to"]["event_id"] = msgid