Allow tracking words that have characters deemed as "start"/"end" characters

(words.py)
This commit is contained in:
jesopo 2019-01-04 12:13:36 +00:00
parent 47b17def99
commit 8171c5c492

View file

@ -22,9 +22,15 @@ class Module(ModuleManager.BaseModule):
tracked_words = set(event["server"].get_setting(
"tracked-words", []))
for word in words:
word = word.lstrip(WORD_START).rstrip(WORD_STOP)
stripped_word = word.lstrip(WORD_START).rstrip(WORD_STOP)
found = None
if word.lower() in tracked_words:
setting = "word-%s" % word
found = word.lower()
elif strippped_word.lower() in tracked_words:
found = stripped_word.lower()
if found:
setting = "word-%s" % found
word_count = user.get_setting(setting, 0)
word_count += 1
user.set_setting(setting, word_count)