aboutsummaryrefslogtreecommitdiff
path: root/modules/thesaurus.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-09-26 18:27:17 +0100
committerGravatar jesopo2018-09-26 18:27:17 +0100
commit51a52e2b0e54031cce5876f54d1d48c268b5441c (patch)
treea4c0e8e86c55aa701b06297d5b5a2ceebeaab60d /modules/thesaurus.py
parentAlso 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.py8
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)