From e3e353aab48f96d300c7097860a1dabce0454179 Mon Sep 17 00:00:00 2001 From: gammafn Date: Wed, 12 Jan 2022 22:09:23 -0600 Subject: [PATCH] apod: prettier output for non-images --- modules/apod.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/apod.py b/modules/apod.py index 6e7df90..b04c0ac 100644 --- a/modules/apod.py +++ b/modules/apod.py @@ -114,8 +114,12 @@ class MatrixModule(BotModule): async def send_unknown_mediatype(self, room, bot, apod): self.logger.debug(f"unknown media_type: {apod.media_type}. sending raw information") - await bot.send_text(room, f"{apod.title}") - await bot.send_text(room, f"{apod.explanation} || date: {apod.date} || original-url: {apod.url}") + await bot.send_html(room, + f"

{html.escape(apod.title)} ({html.escape(apod.date)})" + f"
(Original URL: {apod.url})

" + f"\n

{apod.explanation}

", + f"{apod.title} ({apod.date}) | Original URL: {apod.url}" + f"\n{apod.explanation}") def get_settings(self): data = super().get_settings()