Parse markdown in misskey preview

This commit is contained in:
Nexus 2024-08-03 19:19:55 +01:00
parent 8060430754
commit 419e08f760
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -38,7 +38,10 @@ class MisskeyPreviewModule(niobot.Module):
username = data["user"]["username"]
if not data["text"]:
continue
text_body = "<blockquote>%s</blockquote>" % "".join(textwrap.shorten(data["text"], width=1000))
text = textwrap.shorten(data["text"], width=1000)
rendered = self.bot._markdown_to_html(text)
text_body = "<blockquote>%s</blockquote>" % rendered
body = "<a href=\"%s\">@%s:</a><br>%s" % (
"https://%s/@%s" % (parsed.netloc, username),
username,