From d100ffc5d3b47876fcef1e1c7078e6c5b600ef46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Wed, 19 Jun 2024 16:43:42 +0200 Subject: [PATCH] Move blacklist check above whitelist check --- discord_rss_bot/feeds.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/discord_rss_bot/feeds.py b/discord_rss_bot/feeds.py index 62dda6b..11b1c86 100644 --- a/discord_rss_bot/feeds.py +++ b/discord_rss_bot/feeds.py @@ -219,6 +219,12 @@ def send_to_discord(custom_reader: Reader | None = None, feed: Feed | None = Non # Create the webhook. webhook: DiscordWebhook = DiscordWebhook(url=webhook_url, content=webhook_message, rate_limit_retry=True) + # Check if the entry is blacklisted, if it is, mark it as read and continue. + if should_be_skipped(reader, entry): + logger.info("Entry was blacklisted: %s", entry.id) + reader.set_entry_read(entry, True) + continue + # Check if the feed has a whitelist, and if it does, check if the entry is whitelisted. if has_white_tags(reader, entry.feed): if should_be_sent(reader, entry): @@ -231,12 +237,6 @@ def send_to_discord(custom_reader: Reader | None = None, feed: Feed | None = Non reader.set_entry_read(entry, True) continue - # Check if the entry is blacklisted, if it is, mark it as read and continue. - if should_be_skipped(reader, entry): - logger.info("Entry was blacklisted: %s", entry.id) - reader.set_entry_read(entry, True) - continue - # It was not blacklisted, and not forced through whitelist, so we will send it to Discord. response: Response = webhook.execute() if response.status_code not in {200, 204}: