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 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"]:

View file

@ -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)

View file

@ -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: