Skip to content

Commit

Permalink
Merge pull request #35 from srobo/fix/blog-posts-without-thumbnail
Browse files Browse the repository at this point in the history
Fix handling of posts without a thumbnail image
  • Loading branch information
raccube authored Sep 3, 2024
2 parents b12c959 + e1caf2d commit a24cb5a
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 len(post.media_thumbnail) > 0:
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 a24cb5a

Please sign in to comment.