From 51a52e2b0e54031cce5876f54d1d48c268b5441c Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 26 Sep 2018 18:27:17 +0100 Subject: Switch to using @Utils.hook and docstrings for event hooks --- modules/urbandictionary.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'modules/urbandictionary.py') diff --git a/modules/urbandictionary.py b/modules/urbandictionary.py index bb0f7918..6151afb8 100644 --- a/modules/urbandictionary.py +++ b/modules/urbandictionary.py @@ -1,16 +1,16 @@ import json, re -from src import Utils +from src import ModuleManager, Utils URL_URBANDICTIONARY = "http://api.urbandictionary.com/v0/define" REGEX_DEFNUMBER = re.compile("-n(\d+) \S+") -class Module(object): - def __init__(self, bot, events, exports): - events.on("received.command").on("urbandictionary", "ud").hook( - self.ud, min_args=1, help="Get the definition of a provided term", - usage="") - +class Module(ModuleManager.BaseModule): + @Utils.hook("received.command.urbandictionary|ud", min_args=1, + usage="") def ud(self, event): + """ + Get the definition of a provided term from Urban Dictionary + """ term = event["args"] number = 1 match = re.match(REGEX_DEFNUMBER, term) -- cgit v1.3.1-10-gc9f91