diff --git a/filters.py b/filters.py index fda11fafc..4ae1fcede 100644 --- a/filters.py +++ b/filters.py @@ -93,8 +93,12 @@ def isFiltered(baseDir: str, nickname: str, domain: str, content: str) -> bool: """ globalFiltersFilename = baseDir + '/accounts/filters.txt' if os.path.isfile(globalFiltersFilename): - if content + '\n' in open(globalFiltersFilename).read(): - return True + wordsFile = open(globalFiltersFilename, 'r') + if wordsFile: + wordsList = wordsFile.read().split('\n') + for word in wordsList: + if word in content: + return True if not nickname or not domain: return False