Fix HTML output

This commit is contained in:
Nexus 2024-08-03 01:57:52 +01:00
parent 4387c25fe9
commit 3a92ba3b99
2 changed files with 3 additions and 5 deletions

View file

@ -38,13 +38,11 @@ class MisskeyPreviewModule(niobot.Module):
username = data["user"]["username"] username = data["user"]["username"]
if not data["text"]: if not data["text"]:
continue continue
text_body = [] text_body = "<blockquote>%s</blockquote>" % "".join(textwrap.shorten(data["text"], width=1000))
for line in textwrap.shorten(data["text"], width=1000).splitlines(keepends=True): body = "<a href=\"%s\">@%s:</a><br>%s" % (
text_body.append("> " + (line or "\u200b"))
body = "<a href=\"%s\">@%s:</a>\n\n%s" % (
"https://%s/@%s" % (parsed.netloc, username), "https://%s/@%s" % (parsed.netloc, username),
username, username,
"".join(text_body), text_body,
) )
await self.bot.send_message( await self.bot.send_message(
room, room,

View file