Use PRIORITY_MONITOR for keeping count of words (to avoid seeing commands)

This commit is contained in:
jesopo 2018-10-02 14:29:51 +01:00
parent 64733eb37f
commit 67c22416cc

View file

@ -1,5 +1,5 @@
import time
from src import ModuleManager, Utils
from src import EventManager, ModuleManager, Utils
class Module(ModuleManager.BaseModule):
def _channel_message(self, user, event):
@ -23,10 +23,12 @@ class Module(ModuleManager.BaseModule):
word_count = user.get_setting(setting, 0)
word_count += 1
user.set_setting(setting, word_count)
@Utils.hook("received.message.channel")
@Utils.hook("received.message.channel",
priority=EventManager.PRIORITY_MONITOR)
def channel_message(self, event):
self._channel_message(event["user"], event)
@Utils.hook("self.message.channel")
@Utils.hook("self.message.channel",
priority=EventManager.PRIORITY_MONITOR)
def self_channel_message(self, event):
self._channel_message(event["server"].get_user(
event["server"].nickname), event)