Skip to content

Commit

Permalink
Handle empty media:thumbnails in posts
Browse files Browse the repository at this point in the history
Co-authored-by: Jake Howard <RealOrangeOne@users.noreply.github.com>
  • Loading branch information
raccube and RealOrangeOne authored Sep 3, 2024
1 parent 36d7fda commit e1caf2d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sr/discord_bot/rss.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def create_embed(post: FeedParserDict) -> discord.Embed:
description=text,
)

if post.has_key('media_thumbnail'):
embed.set_image(url=post['media_thumbnail'][0]['url'])
if media_thumbnails := post.get('media_thumbnail'):
embed.set_image(url=media_thumbnails[0]['url'])

return embed

0 comments on commit e1caf2d

Please sign in to comment.