diff options
| author | 2018-08-05 17:16:15 +0100 | |
|---|---|---|
| committer | 2018-08-05 17:16:15 +0100 | |
| commit | 6a7369f7debd1a518822d2d789c13d43a06c5b2a (patch) | |
| tree | bf031d32450874584295fe82f4727e23243aa27a /modules/words.py | |
| parent | only get "sed" setting when a message that looks like a sed command comes in (diff) | |
| signature | ||
changed words.py to use new user_channel_settings table
Diffstat (limited to 'modules/words.py')
| -rw-r--r-- | modules/words.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/words.py b/modules/words.py index bc864daa..68971f24 100644 --- a/modules/words.py +++ b/modules/words.py @@ -22,11 +22,11 @@ class Module(object): words = list(filter(None, event["message_split"])) word_count = len(words) - user_words = event["user"].get_setting("words", {}) - if not event["channel"].name in user_words: - user_words[event["channel"].name] = 0 - user_words[event["channel"].name] += word_count - event["user"].set_setting("words", user_words) + user_words = event["channel"].get_user_setting( + event["user"].nickname, "words", 0) + user_words += word_count + event["channel"].set_user_setting(event["user"].nickname, + "words", user_words) tracked_words = set(event["server"].get_setting( "tracked-words", [])) @@ -43,8 +43,10 @@ class Module(object): ][0]) else: target = event["user"] - words = target.get_setting("words", {}) + words = dict(target.get_channel_settings_per_setting( + "words", [])) this_channel = words.get(event["target"].name, 0) + total = 0 for channel in words: total += words[channel] |
