diff --git a/discord_rss_bot/blacklist.py b/discord_rss_bot/blacklist.py
index b48e09d..351bcbd 100644
--- a/discord_rss_bot/blacklist.py
+++ b/discord_rss_bot/blacklist.py
@@ -3,19 +3,26 @@ import re
from reader import Entry, Feed, Reader, TagNotFoundError
-def is_word_in_text(word: str, text: str) -> bool:
+def is_word_in_text(words: str, text: str) -> bool:
"""
Args:
- word: The word to search for.
+ words: The words to search for.
text: The text to search in.
Returns:
bool: If the word is in the text.
"""
- pattern = rf"(^|[^\w]){word}([^\w]|$)"
- pattern = re.compile(pattern, re.IGNORECASE)
- matches = re.search(pattern, text)
- return bool(matches)
+ # Split the word list into a list of words.
+ word_list = words.split(",")
+
+ # Check if each word is in the text.
+ for word in word_list:
+ pattern = rf"(^|[^\w]){word}([^\w]|$)"
+ pattern = re.compile(pattern, re.IGNORECASE)
+ matches = re.search(pattern, text)
+ if matches:
+ return True
+ return False
def has_black_tags(custom_reader: Reader, feed: Feed) -> bool:
diff --git a/discord_rss_bot/templates/blacklist.html b/discord_rss_bot/templates/blacklist.html
index 0db4b3d..7714de0 100644
--- a/discord_rss_bot/templates/blacklist.html
+++ b/discord_rss_bot/templates/blacklist.html
@@ -9,19 +9,20 @@
Comma separated list of words to blacklist. If a word is found in the
corresponding blacklists, the feed will not be sent. Whitelist always takes precedence over
- blacklist. Leave empty to disable. Words are case-insensitive.
+ blacklist. Leave empty to disable. Words are case-insensitive. No spaces should be used before
+ or after the comma.
Comma separated list of words to whitelist. Only send message to
Discord if one of these words are present in the corresponding fields.
Whitelist always takes precedence over blacklist. Leave empty to disable.
- Words are case-insensitive.
+ Words are case-insensitive. No spaces should be used before or after the comma.
+ id="whitelist_title" placeholder="primogem,events,gameplay preview,special program">
+ id="whitelist_summary" placeholder="primogem,events,gameplay preview,special program">
+ id="whitelist_content" placeholder="primogem,events,gameplay preview,special program">
diff --git a/discord_rss_bot/whitelist.py b/discord_rss_bot/whitelist.py
index 0b314cf..57f3ac8 100644
--- a/discord_rss_bot/whitelist.py
+++ b/discord_rss_bot/whitelist.py
@@ -3,19 +3,26 @@ import re
from reader import Entry, Feed, Reader, TagNotFoundError
-def is_word_in_text(word: str, text: str) -> bool:
+def is_word_in_text(words: str, text: str) -> bool:
"""
Args:
- word: The word to search for.
+ words: The words to search for.
text: The text to search in.
Returns:
bool: If the word is in the text.
"""
- pattern = rf"(^|[^\w]){word}([^\w]|$)"
- pattern = re.compile(pattern, re.IGNORECASE)
- matches = re.search(pattern, text)
- return bool(matches)
+ # Split the word list into a list of words.
+ word_list = words.split(",")
+
+ # Check if each word is in the text.
+ for word in word_list:
+ pattern = rf"(^|[^\w]){word}([^\w]|$)"
+ pattern = re.compile(pattern, re.IGNORECASE)
+ matches = re.search(pattern, text)
+ if matches:
+ return True
+ return False
def has_white_tags(custom_reader: Reader, feed: Feed) -> bool: