diff options
| author | 2018-09-26 18:27:17 +0100 | |
|---|---|---|
| committer | 2018-09-26 18:27:17 +0100 | |
| commit | 51a52e2b0e54031cce5876f54d1d48c268b5441c (patch) | |
| tree | a4c0e8e86c55aa701b06297d5b5a2ceebeaab60d /modules/thesaurus.py | |
| parent | Also use docstrings to check if a command has help available, allow one-string (diff) | |
| signature | ||
Switch to using @Utils.hook and docstrings for event hooks
Diffstat (limited to 'modules/thesaurus.py')
| -rw-r--r-- | modules/thesaurus.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/thesaurus.py b/modules/thesaurus.py index 9328a330..3791d609 100644 --- a/modules/thesaurus.py +++ b/modules/thesaurus.py @@ -7,11 +7,13 @@ URL_THESAURUS = "http://words.bighugelabs.com/api/2/%s/%s/json" class Module(object): def __init__(self, bot, events, exports): self.bot = bot - events.on("received.command").on("synonym", "antonym").hook( - self.thesaurus, min_args=1, usage="<word> [type]", - help="Get synonyms/antonyms for a provided phrase") + @Utils.hook("received.command.synonym|antonym", min_args=1, + usage="<word> [type]") def thesaurus(self, event): + """ + Get synonyms/antonyms for a provided phrase + """ phrase = event["args_split"][0] page = Utils.get_url(URL_THESAURUS % (self.bot.config[ "bighugethesaurus-api-key"], phrase), json=True) |
