From ccc94da432a4e48d42c788d3673aebdb8107c25f Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 28 Sep 2019 17:20:55 +0300 Subject: [PATCH] Add edits parameter to client.send_markdown --- maubot/matrix.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/maubot/matrix.py b/maubot/matrix.py index a526f8f..1e39e81 100644 --- a/maubot/matrix.py +++ b/maubot/matrix.py @@ -85,11 +85,16 @@ class MaubotMessageEvent(MessageEvent): class MaubotMatrixClient(MatrixClient): def send_markdown(self, room_id: RoomID, markdown: str, msgtype: MessageType = MessageType.TEXT, + edits: Optional[Union[EventID, MessageEvent]] = None, relates_to: Optional[RelatesTo] = None, **kwargs) -> Awaitable[EventID]: content = TextMessageEventContent(msgtype=msgtype, format=Format.HTML) content.body, content.formatted_body = parse_markdown(markdown) if relates_to: + if edits: + raise ValueError("Can't use edits and relates_to at the same time.") content.relates_to = relates_to + elif edits: + content.set_edit(edits) return self.send_message(room_id, content, **kwargs) async def dispatch_event(self, event: Event, source: SyncStream = SyncStream.INTERNAL) -> None: