Merge pull request #60 from ancho/feature/nasa-apod-module

apod send order title -> picture -> description
This commit is contained in:
Ville Ranki 2020-03-18 20:09:12 +02:00 committed by GitHub
commit 2e78289a2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -89,7 +89,7 @@ class MatrixModule(BotModule):
async def send_unknown_mediatype(self, room, bot, apod): async def send_unknown_mediatype(self, room, bot, apod):
self.logger.debug(f"unknown media_type: {apod.media_type}. sending raw information") 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.title}")
await bot.send_text(room, f"explanation: {apod.explanation} date: {apod.date} url: {apod.url}") await bot.send_text(room, f"{apod.explanation} || date: {apod.date} || original-url: {apod.url}")
async def upload_and_send_image(self, room, bot, apod): async def upload_and_send_image(self, room, bot, apod):
url = apod.hdurl if apod.hdurl is not None else apod.url url = apod.hdurl if apod.hdurl is not None else apod.url
@ -103,9 +103,10 @@ class MatrixModule(BotModule):
if matrix_uri is not None: if matrix_uri is not None:
self.matrix_uri_cache[apod.date] = matrix_uri self.matrix_uri_cache[apod.date] = matrix_uri
bot.save_settings() bot.save_settings()
await bot.send_image(room, matrix_uri, f"{apod.title} - url: {url} date: {apod.date}") await bot.send_text(room, f"{apod.title} ({apod.date})")
await bot.send_text(room, f"{apod.title}") await bot.send_image(room, matrix_uri, f"{apod.title}")
await bot.send_text(room, f"explanation: {apod.explanation} date: {apod.date} url: {apod.url}") await bot.send_text(room, f"original-url: {url}")
await bot.send_text(room, f"{apod.explanation}")
else: else:
await bot.send_text(room, "sorry. something went wrong uploading the image to matrix server :(") await bot.send_text(room, "sorry. something went wrong uploading the image to matrix server :(")