Strip specific characters from the front of words too (and add more characters
to strip from the end) in modules/words.py
This commit is contained in:
parent
0e2140b99f
commit
2c815f4bbc
1 changed files with 3 additions and 2 deletions
|
@ -1,7 +1,8 @@
|
||||||
import time
|
import time
|
||||||
from src import EventManager, ModuleManager, utils
|
from src import EventManager, ModuleManager, utils
|
||||||
|
|
||||||
WORD_STOP = ";:.,!?~"
|
WORD_START = "\"“'({<…"
|
||||||
|
WORD_STOP = "\"”')}>;:.,!?~…"
|
||||||
|
|
||||||
class Module(ModuleManager.BaseModule):
|
class Module(ModuleManager.BaseModule):
|
||||||
def _channel_message(self, user, event):
|
def _channel_message(self, user, event):
|
||||||
|
@ -20,7 +21,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
tracked_words = set(event["server"].get_setting(
|
tracked_words = set(event["server"].get_setting(
|
||||||
"tracked-words", []))
|
"tracked-words", []))
|
||||||
for word in words:
|
for word in words:
|
||||||
word = word.rstrip(WORD_STOP)
|
word = word.lstrip(WORD_START).rstrip(WORD_STOP)
|
||||||
if word.lower() in tracked_words:
|
if word.lower() in tracked_words:
|
||||||
setting = "word-%s" % word
|
setting = "word-%s" % word
|
||||||
word_count = user.get_setting(setting, 0)
|
word_count = user.get_setting(setting, 0)
|
||||||
|
|
Loading…
Reference in a new issue