From 499177069cf9c56aabc261afe2a62cefa709bd83 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 22 Jun 2014 12:23:21 +0200 Subject: [PATCH] [AnitAbuse] Use hook mechanism instead of hacky stuff --- antiabuse.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/antiabuse.py b/antiabuse.py index 4eb7295..c3c7a05 100755 --- a/antiabuse.py +++ b/antiabuse.py @@ -10,7 +10,7 @@ antiabuse["ignorelist"] = [] antiabuse["cooldown_l"] = {} antiabuse["cooldown"] = 3 # seconds -def aa_hook(phenny, input): +def aa_hook(phenny, input, func): if input.admin or input.owner: return False @@ -20,9 +20,9 @@ def aa_hook(phenny, input): return True # abort command # Cooldown - try: + if input.nick in antiabuse["cooldown_l"]: ot = antiabuse["cooldown_l"][input.nick] - except: + else: ot = 0 antiabuse["cooldown_l"][input.nick] = time.time() if antiabuse["cooldown_l"][input.nick] - antiabuse["cooldown"] < ot: @@ -31,10 +31,7 @@ def aa_hook(phenny, input): return False -aa_hook.event = 'THISWONTHAPPEN' -aa_hook.priority = 'high' -aa_hook.rule = r'h^' -#XXX: hacky +aa_hook.hook = True def hmasktrans(va): a = "!" in va