Add option to use thread for replies
This commit is contained in:
parent
bf3a3b65d8
commit
f0e2bb3d62
@ -82,6 +82,7 @@ class MaubotMessageEvent(MessageEvent):
|
|||||||
markdown: bool = True,
|
markdown: bool = True,
|
||||||
allow_html: bool = False,
|
allow_html: bool = False,
|
||||||
reply: bool | str = False,
|
reply: bool | str = False,
|
||||||
|
reply_in_thread: bool = False,
|
||||||
edits: EventID | MessageEvent | None = None,
|
edits: EventID | MessageEvent | None = None,
|
||||||
) -> EventID:
|
) -> EventID:
|
||||||
if isinstance(content, str):
|
if isinstance(content, str):
|
||||||
@ -102,6 +103,8 @@ class MaubotMessageEvent(MessageEvent):
|
|||||||
f"{self.sender}"
|
f"{self.sender}"
|
||||||
f"</a>: {fmt_body}"
|
f"</a>: {fmt_body}"
|
||||||
)
|
)
|
||||||
|
elif reply_in_thread:
|
||||||
|
content.set_thread_parent(self)
|
||||||
else:
|
else:
|
||||||
content.set_reply(self)
|
content.set_reply(self)
|
||||||
return await self.client.send_message_event(self.room_id, event_type, content)
|
return await self.client.send_message_event(self.room_id, event_type, content)
|
||||||
@ -112,9 +115,15 @@ class MaubotMessageEvent(MessageEvent):
|
|||||||
event_type: EventType = EventType.ROOM_MESSAGE,
|
event_type: EventType = EventType.ROOM_MESSAGE,
|
||||||
markdown: bool = True,
|
markdown: bool = True,
|
||||||
allow_html: bool = False,
|
allow_html: bool = False,
|
||||||
|
thread: bool = False,
|
||||||
) -> Awaitable[EventID]:
|
) -> Awaitable[EventID]:
|
||||||
return self.respond(
|
return self.respond(
|
||||||
content, event_type, markdown=markdown, reply=True, allow_html=allow_html
|
content,
|
||||||
|
event_type,
|
||||||
|
markdown=markdown,
|
||||||
|
reply=True,
|
||||||
|
reply_in_thread=thread,
|
||||||
|
allow_html=allow_html,
|
||||||
)
|
)
|
||||||
|
|
||||||
def mark_read(self) -> Awaitable[None]:
|
def mark_read(self) -> Awaitable[None]:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
mautrix>=0.15.5,<0.19
|
mautrix>=0.16.2,<0.20
|
||||||
aiohttp>=3,<4
|
aiohttp>=3,<4
|
||||||
yarl>=1,<2
|
yarl>=1,<2
|
||||||
SQLAlchemy>=1,<1.4
|
SQLAlchemy>=1,<1.4
|
||||||
|
Loading…
Reference in New Issue
Block a user