fixed a couple of problems in some modules.

This commit is contained in:
jesopo 2016-03-29 21:06:07 +01:00
parent 076552c013
commit 426068f0cf
No known key found for this signature in database
GPG key ID: 0BBDEB2AEFCFFCB3
3 changed files with 16 additions and 14 deletions

View file

@ -19,18 +19,20 @@ class Module(object):
if match: if match:
if not event["user"].last_karma or (time.time()-event["user" if not event["user"].last_karma or (time.time()-event["user"
].last_karma) >= KARMA_DELAY_SECONDS: ].last_karma) >= KARMA_DELAY_SECONDS:
positive = match.group(2)[0] == "+" target = match.group(1).lower().strip()
setting = "karma-%s" % match.group(1).strip() if not target == event["user"].name:
karma = event["server"].get_setting(setting, 0) positive = match.group(2)[0] == "+"
if positive: setting = "karma-%s" % target
karma += 1 karma = event["server"].get_setting(setting, 0)
else: if positive:
karma -= 1 karma += 1
if karma: else:
event["server"].set_setting(setting, karma) karma -= 1
else: if karma:
event["server"].del_setting(setting) event["server"].set_setting(setting, karma)
event["user"].last_karma = time.time() else:
event["server"].del_setting(setting)
event["user"].last_karma = time.time()
def karma(self, event): def karma(self, event):
if event["args"]: if event["args"]:

View file

@ -7,7 +7,7 @@ class Module(object):
def on_connect(self, event): def on_connect(self, event):
nickserv_password = event["server"].get_setting( nickserv_password = event["server"].get_setting(
"nickserv_password") "nickserv-password")
if nickserv_password: if nickserv_password:
event["server"].send_message("nickserv", event["server"].send_message("nickserv",
"identify %s" % nickserv_password) "identify %s" % nickserv_password)

View file

@ -14,7 +14,7 @@ class Module(object):
if len(event["args"]) > 0: if len(event["args"]) > 0:
url = event["args_split"][0] url = event["args_split"][0]
else: else:
url = event["channel"].log.find(REGEX_URL) url = event["log"].find(REGEX_URL)
if url: if url:
url = re.search(REGEX_URL, url.message).group(0) url = re.search(REGEX_URL, url.message).group(0)
if not url: if not url: