From 36d7fdaef15caaf178756d0cd162215a76b5a929 Mon Sep 17 00:00:00 2001 From: "Karina J. Kwiatek" Date: Tue, 3 Sep 2024 21:29:29 +0200 Subject: [PATCH] Fix handling of posts without a thumbnail image --- src/sr/discord_bot/rss.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sr/discord_bot/rss.py b/src/sr/discord_bot/rss.py index 394420e..05daeb9 100644 --- a/src/sr/discord_bot/rss.py +++ b/src/sr/discord_bot/rss.py @@ -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 post.has_key('media_thumbnail'): + embed.set_image(url=post['media_thumbnail'][0]['url']) return embed