diff --git a/DayOfTheWeek.py b/DayOfTheWeek.py index fbf4fd7..ba28bb3 100644 --- a/DayOfTheWeek.py +++ b/DayOfTheWeek.py @@ -17,28 +17,28 @@ class Meme: def get_random_attachment(self) -> str or None: attachments = self.meta.get('attachments') - if len(attachments) < 1: + if not attachments: return None return random.choice(self.flatten_meta(attachments)) def get_random_audio(self) -> str or None: attachments = self.meta.get('attachments') - if len(attachments) < 1 or attachments.get('audio') is None: + if not attachments or attachments.get('audio') is None: return None return random.choice(attachments.get('audio')) def get_random_video(self) -> str or None: attachments = self.meta.get('attachments') - if len(attachments) < 1 or attachments.get('video') is None: + if not attachments or attachments.get('video') is None: return None return random.choice(attachments.get('video')) @staticmethod def flatten_meta(meta: dict[str, any]) -> list[str]: - return [a for k in [i for i in meta] for a in k] + return [a for k in [i for i in meta.values()] for a in k] class Day: