aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar jesopo2018-10-11 12:55:19 +0100
committerGravatar jesopo2018-10-11 12:55:19 +0100
commit98cdfa6419e35c4e3d0ddc4b623e1c39cc49da0f (patch)
treec7951d67756ff22c2faaf294e98ee3f4fef94deb /modules
parentAdd modules/rot13.py (diff)
signature
Strip common characters that mark the end of a word (":;,!?~") from the end of
words in modules/words.py
Diffstat (limited to 'modules')
-rw-r--r--modules/words.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/words.py b/modules/words.py
index 160325ff..e5e1ff16 100644
--- a/modules/words.py
+++ b/modules/words.py
@@ -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)