mirror of
https://github.com/maubot/maubot
synced 2025-08-28 20:30:38 +00:00
Also allow setting extra content in send_markdown
Some checks failed
Python lint / lint (push) Has been cancelled
Some checks failed
Python lint / lint (push) Has been cancelled
This commit is contained in:
parent
94c4e5aaaf
commit
87bb7fc854
1 changed files with 8 additions and 1 deletions
|
@ -264,14 +264,18 @@ class MaubotMatrixClient(MatrixClient):
|
|||
markdown: str,
|
||||
*,
|
||||
allow_html: bool = False,
|
||||
render_markdown: bool = True,
|
||||
msgtype: MessageType = MessageType.TEXT,
|
||||
edits: EventID | MessageEvent | None = None,
|
||||
relates_to: RelatesTo | None = None,
|
||||
extra_content: dict[str, Any] = None,
|
||||
**kwargs,
|
||||
) -> EventID:
|
||||
content = TextMessageEventContent(msgtype=msgtype, format=Format.HTML)
|
||||
content.body, content.formatted_body = await parse_formatted(
|
||||
markdown, allow_html=allow_html
|
||||
markdown,
|
||||
allow_html=allow_html,
|
||||
render_markdown=render_markdown,
|
||||
)
|
||||
if relates_to:
|
||||
if edits:
|
||||
|
@ -279,6 +283,9 @@ class MaubotMatrixClient(MatrixClient):
|
|||
content.relates_to = relates_to
|
||||
elif edits:
|
||||
content.set_edit(edits)
|
||||
if extra_content:
|
||||
for k, v in extra_content.items():
|
||||
content[k] = v
|
||||
return await self.send_message(room_id, content, **kwargs)
|
||||
|
||||
def dispatch_event(self, event: Event, source: SyncStream) -> list[asyncio.Task]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue