.BANCHO. .FIX. Filters are now case sensitive
This commit is contained in:
parent
14348a68bb
commit
ea7cd9ff30
|
@ -16,7 +16,9 @@ class chatFilters:
|
||||||
for line in data:
|
for line in data:
|
||||||
# Get old/new word and save it in dictionary
|
# Get old/new word and save it in dictionary
|
||||||
lineSplit = line.split("=")
|
lineSplit = line.split("=")
|
||||||
self.filters[lineSplit[0]] = lineSplit[1].replace("\n", "")
|
self.filters[lineSplit[0].lower()] = lineSplit[1].replace("\n", "")
|
||||||
|
|
||||||
|
print(str(self.filters))
|
||||||
|
|
||||||
def filterMessage(self, message):
|
def filterMessage(self, message):
|
||||||
# Split words by spaces
|
# Split words by spaces
|
||||||
|
@ -24,9 +26,11 @@ class chatFilters:
|
||||||
|
|
||||||
# Check each word
|
# Check each word
|
||||||
for word in messageTemp:
|
for word in messageTemp:
|
||||||
|
lowerWord = word.lower()
|
||||||
|
|
||||||
# If the word is filtered, replace it
|
# If the word is filtered, replace it
|
||||||
if word in self.filters:
|
if lowerWord in self.filters:
|
||||||
message = message.replace(word, self.filters[word])
|
message = message.replace(word, self.filters[lowerWord])
|
||||||
|
|
||||||
# Return filtered message
|
# Return filtered message
|
||||||
return message
|
return message
|
||||||
|
|
Loading…
Reference in New Issue
Block a user