From 426068f0cf10edb4770e48865df1c779e1a11e14 Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 29 Mar 2016 21:06:07 +0100 Subject: [PATCH] fixed a couple of problems in some modules. --- modules/karma.py | 26 ++++++++++++++------------ modules/nickserv.py | 2 +- modules/title.py | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/modules/karma.py b/modules/karma.py index c596ee53..64552378 100644 --- a/modules/karma.py +++ b/modules/karma.py @@ -19,18 +19,20 @@ class Module(object): if match: if not event["user"].last_karma or (time.time()-event["user" ].last_karma) >= KARMA_DELAY_SECONDS: - positive = match.group(2)[0] == "+" - setting = "karma-%s" % match.group(1).strip() - karma = event["server"].get_setting(setting, 0) - if positive: - karma += 1 - else: - karma -= 1 - if karma: - event["server"].set_setting(setting, karma) - else: - event["server"].del_setting(setting) - event["user"].last_karma = time.time() + target = match.group(1).lower().strip() + if not target == event["user"].name: + positive = match.group(2)[0] == "+" + setting = "karma-%s" % target + karma = event["server"].get_setting(setting, 0) + if positive: + karma += 1 + else: + karma -= 1 + if karma: + event["server"].set_setting(setting, karma) + else: + event["server"].del_setting(setting) + event["user"].last_karma = time.time() def karma(self, event): if event["args"]: diff --git a/modules/nickserv.py b/modules/nickserv.py index bd7bccdc..a8d815b7 100644 --- a/modules/nickserv.py +++ b/modules/nickserv.py @@ -7,7 +7,7 @@ class Module(object): def on_connect(self, event): nickserv_password = event["server"].get_setting( - "nickserv_password") + "nickserv-password") if nickserv_password: event["server"].send_message("nickserv", "identify %s" % nickserv_password) diff --git a/modules/title.py b/modules/title.py index 22795091..23c966bb 100644 --- a/modules/title.py +++ b/modules/title.py @@ -14,7 +14,7 @@ class Module(object): if len(event["args"]) > 0: url = event["args_split"][0] else: - url = event["channel"].log.find(REGEX_URL) + url = event["log"].find(REGEX_URL) if url: url = re.search(REGEX_URL, url.message).group(0) if not url: