Move blacklist check above whitelist check

This commit is contained in:
2024-06-19 16:43:42 +02:00
parent 16ecf80150
commit d100ffc5d3

View File

@ -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}: