diff options
| author | 2018-09-26 18:27:17 +0100 | |
|---|---|---|
| committer | 2018-09-26 18:27:17 +0100 | |
| commit | 51a52e2b0e54031cce5876f54d1d48c268b5441c (patch) | |
| tree | a4c0e8e86c55aa701b06297d5b5a2ceebeaab60d /modules/urbandictionary.py | |
| parent | Also use docstrings to check if a command has help available, allow one-string (diff) | |
Switch to using @Utils.hook and docstrings for event hooks
Diffstat (limited to 'modules/urbandictionary.py')
| -rw-r--r-- | modules/urbandictionary.py | 14 |
1 files changed, 7 insertions, 7 deletions
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="<term>") - +class Module(ModuleManager.BaseModule): + @Utils.hook("received.command.urbandictionary|ud", min_args=1, + usage="<term>") 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) |
