support disabling word tracking per channel, not just per user

This commit is contained in:
jesopo 2019-09-10 10:34:44 +01:00
parent a9d11fc7f8
commit bad108d7ce

View file

@ -9,11 +9,15 @@ WORD_DELIM = "\"'…~*`"
WORD_START = WORD_DELIM+"“({<" WORD_START = WORD_DELIM+"“({<"
WORD_STOP = WORD_DELIM+"”)}>;:.,!?" WORD_STOP = WORD_DELIM+"”)}>;:.,!?"
@utils.export("set", utils.BoolSetting( SETTING = utils.BoolSetting("word-tracking",
"word-tracking", "Disable/enable tracking your wordcounts")) "Disable/enable tracking your wordcounts")
@utils.export("set", SETTING)
@utils.export("channelset", SETTING)
class Module(ModuleManager.BaseModule): class Module(ModuleManager.BaseModule):
def _channel_message(self, user, event): def _channel_message(self, user, event):
if not user.get_setting("word-tracking", True): if not event["channel"].get_setting("word-tracking", True
) or not user.get_setting("word-tracking", True):
return return
words = list(filter(None, event["message_split"])) words = list(filter(None, event["message_split"]))