Strip common characters that mark the end of a word (":;,!?~") from the end of

words in modules/words.py
This commit is contained in:
jesopo 2018-10-11 12:55:19 +01:00
parent 1c2504ac98
commit 98cdfa6419

View file

@ -1,6 +1,8 @@
import time
from src import EventManager, ModuleManager, utils
WORD_STOP = ";:,!?~"
class Module(ModuleManager.BaseModule):
def _channel_message(self, user, event):
words = list(filter(None, event["message_split"]))
@ -18,6 +20,7 @@ class Module(ModuleManager.BaseModule):
tracked_words = set(event["server"].get_setting(
"tracked-words", []))
for word in words:
word = word.rstrip(WORD_STOP)
if word.lower() in tracked_words:
setting = "word-%s" % word
word_count = user.get_setting(setting, 0)