From aa51cc4301193ba45a18be6651b312e75b904e0b Mon Sep 17 00:00:00 2001 From: Carsten Burgard Date: Fri, 15 Apr 2022 14:27:45 +0200 Subject: [PATCH] bugfix for missing thumbnail --- PlexBot/bot.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/PlexBot/bot.py b/PlexBot/bot.py index 94056ee..459b649 100644 --- a/PlexBot/bot.py +++ b/PlexBot/bot.py @@ -399,11 +399,15 @@ class Plex(commands.Cog): ValueError: Unsupported type of embed {type_} """ # Grab the relevant thumbnail - img_stream = requests.get(track.thumbUrl, stream=True).raw - img = io.BytesIO(img_stream.read()) + if track.thumbUrl: + img_stream = requests.get(track.thumbUrl, stream=True).raw + img = io.BytesIO(img_stream.read()) - # Attach to discord embed - art_file = discord.File(img, filename="image0.png") + # Attach to discord embed + art_file = discord.File(img, filename="image0.png") + else: + art_file = None + # Get appropiate status message if type_ == "play": title = f"Now Playing - {track.title}"