fixed a couple of problems in some modules.
This commit is contained in:
parent
076552c013
commit
426068f0cf
3 changed files with 16 additions and 14 deletions
|
@ -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"]:
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue