Remove print statements

This commit is contained in:
2023-01-17 01:38:07 +01:00
parent 202c0b1212
commit ace8d238bf
4 changed files with 0 additions and 16 deletions

View File

@ -45,23 +45,19 @@ def send_to_discord(custom_reader: Reader | None = None, feed: Feed | None = Non
webhook_message: str = f"{entry.title}\n{entry.link}"
if not webhook_url:
print(f"Error: No webhook found for feed: {entry.feed.title}")
continue
webhook: DiscordWebhook = DiscordWebhook(url=webhook_url, content=webhook_message, rate_limit_retry=True)
if custom_message.get_custom_message(reader, entry.feed) != "":
print("Custom message found, replacing tags.")
webhook.content = custom_message.replace_tags(entry=entry, feed=entry.feed)
print(f"Webhook content: {webhook.content}")
if feed is not None and has_white_tags(reader, feed):
# Only send the entry if it is whitelisted, otherwise, mark it as read and continue.
if should_be_sent(reader, entry):
response: Response = webhook.execute()
reader.set_entry_read(entry, True)
if not response.ok:
print(f"Error sending to Discord: {response.text}")
reader.set_entry_read(entry, False)
else:
reader.set_entry_read(entry, True)
@ -69,14 +65,12 @@ def send_to_discord(custom_reader: Reader | None = None, feed: Feed | None = Non
# Check if the entry is blacklisted, if it is, mark it as read and continue.
if should_be_skipped(reader, entry):
print(f"Blacklisted entry: {entry.title}, not sending to Discord.")
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 not response.ok:
print(f"Error sending to Discord: {response.text}")
reader.set_entry_read(entry, False)
# If we only want to send one entry, we will break the loop. This is used when testing this function.