[AnitAbuse] Use hook mechanism instead of hacky stuff
parent
5344d7fb9b
commit
499177069c
11
antiabuse.py
11
antiabuse.py
|
@ -10,7 +10,7 @@ antiabuse["ignorelist"] = []
|
||||||
antiabuse["cooldown_l"] = {}
|
antiabuse["cooldown_l"] = {}
|
||||||
antiabuse["cooldown"] = 3 # seconds
|
antiabuse["cooldown"] = 3 # seconds
|
||||||
|
|
||||||
def aa_hook(phenny, input):
|
def aa_hook(phenny, input, func):
|
||||||
if input.admin or input.owner:
|
if input.admin or input.owner:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -20,9 +20,9 @@ def aa_hook(phenny, input):
|
||||||
return True # abort command
|
return True # abort command
|
||||||
|
|
||||||
# Cooldown
|
# Cooldown
|
||||||
try:
|
if input.nick in antiabuse["cooldown_l"]:
|
||||||
ot = antiabuse["cooldown_l"][input.nick]
|
ot = antiabuse["cooldown_l"][input.nick]
|
||||||
except:
|
else:
|
||||||
ot = 0
|
ot = 0
|
||||||
antiabuse["cooldown_l"][input.nick] = time.time()
|
antiabuse["cooldown_l"][input.nick] = time.time()
|
||||||
if antiabuse["cooldown_l"][input.nick] - antiabuse["cooldown"] < ot:
|
if antiabuse["cooldown_l"][input.nick] - antiabuse["cooldown"] < ot:
|
||||||
|
@ -31,10 +31,7 @@ def aa_hook(phenny, input):
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
aa_hook.event = 'THISWONTHAPPEN'
|
aa_hook.hook = True
|
||||||
aa_hook.priority = 'high'
|
|
||||||
aa_hook.rule = r'h^'
|
|
||||||
#XXX: hacky
|
|
||||||
|
|
||||||
def hmasktrans(va):
|
def hmasktrans(va):
|
||||||
a = "!" in va
|
a = "!" in va
|
||||||
|
|
Loading…
Reference in New Issue