Using newly added Python decorator for hook registration

This commit is contained in:
nemunaire 2014-08-12 20:10:19 +02:00
parent 23bc61cce0
commit fe0f120038
19 changed files with 119 additions and 147 deletions

View file

@ -3,6 +3,8 @@
import urllib.request
import json
import re
from hooks import hook
from tools import web
from tools.web import striphtml
@ -14,11 +16,7 @@ def help_tiny ():
def help_full ():
return "!tcode <transaction code|keywords>"
def load(context):
from hooks import Hook
add_hook("cmd_hook", Hook(cmd_tcode, "tcode"))
@hook("cmd_hook", "tcode")
def cmd_tcode(msg):
if len(msg.cmds) != 2:
raise IRCException("indicate a transaction code or a keyword to search!")