Strip common characters that mark the end of a word (":;,!?~") from the end of
words in modules/words.py
This commit is contained in:
parent
1c2504ac98
commit
98cdfa6419
1 changed files with 3 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue