From 86c8495e88f4dbf6a9b9b39451fc654b53f7408b Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Sat, 27 Feb 2021 11:10:45 +0100 Subject: [PATCH] Re-use types here too --- LogBot/logbot.py | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/LogBot/logbot.py b/LogBot/logbot.py index fd87ece..ecd1d03 100644 --- a/LogBot/logbot.py +++ b/LogBot/logbot.py @@ -92,33 +92,13 @@ def download(self, message, logger): # define media_post media_path = os.path.join(media_type, filename) - if message.url.lower().endswith( - (".jpg", "jpeg", "png", ".gif", ".bmp", ".svg", "eps") - ): + if message.url.lower().endswith(IMAGE_TYPES): media_post = f'' - elif message.url.lower().endswith(".pdf"): + elif message.url.lower().endswith(FILE_TYPES): media_post = f'' - elif message.url.lower().endswith( - (".mp3", ".ogg", ".oga", ".mogg", ".wav", ".m4a", ".webm") - ): + elif message.url.lower().endswith(AUDIO_TYPES): media_post = f'' - elif message.url.lower().endswith( - ( - ".mp4", - ".webm", - ".flv", - ".vob", - ".avi", - ".mov", - ".qt", - ".mpg", - ".mpeg", - ".mp4", - ".m2v", - ".mpe", - ".3gp", - ) - ): + elif message.url.lower().endswith(VIDEO_TYPES): media_post = f'' else: media_post = None