From 33180f1d36cfee904f23d16891c66cf5b5a02c75 Mon Sep 17 00:00:00 2001 From: pacnpal <183241239+pacnpal@users.noreply.github.com> Date: Fri, 15 Nov 2024 18:26:01 +0000 Subject: [PATCH] Fix URL detection logic - Accept all URLs if no sites are enabled (default behavior) - Only filter URLs against enabled_sites if specific sites are set - Add detailed logging for URL detection process - Log guild settings and enabled sites This fixes the issue where URLs weren't being detected when no sites were explicitly enabled. --- videoarchiver/processor.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/videoarchiver/processor.py b/videoarchiver/processor.py index 5b70b88..fe6a1b2 100644 --- a/videoarchiver/processor.py +++ b/videoarchiver/processor.py @@ -204,13 +204,16 @@ class VideoProcessor: if message.content: # Log message content for debugging logger.debug(f"Processing message content: {message.content}") - logger.debug(f"Enabled sites: {settings.get('enabled_sites', [])}") + enabled_sites = settings.get("enabled_sites", []) + logger.debug(f"Enabled sites: {enabled_sites}") # Add URLs from message content for word in message.content.split(): # Log each word being checked logger.debug(f"Checking word: {word}") - if any(site in word.lower() for site in settings.get("enabled_sites", [])): + # If no sites are enabled, accept all URLs + # Otherwise, check if URL contains any enabled site + if not enabled_sites or any(site in word.lower() for site in enabled_sites): logger.debug(f"Found matching URL: {word}") urls.append(word)