aboutsummaryrefslogtreecommitdiff
path: root/modules/thesaurus.py
diff options
context:
space:
mode:
authorGravatar dngfx2018-08-31 10:51:47 +0100
committerGravatar dngfx2018-08-31 10:51:47 +0100
commit90ce92dc39395444862edfc7946ef7a1195f2464 (patch)
tree6832c146a15879df292d265083bfe5795cbdfa69 /modules/thesaurus.py
parentReformat (diff)
Revert "Reformat"
This reverts commit abed9cf
Diffstat (limited to 'modules/thesaurus.py')
-rw-r--r--modules/thesaurus.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/modules/thesaurus.py b/modules/thesaurus.py
index 3174518b..2580c191 100644
--- a/modules/thesaurus.py
+++ b/modules/thesaurus.py
@@ -1,24 +1,21 @@
-# --require-config bighugethesaurus-api-key
+#--require-config bighugethesaurus-api-key
import Utils
URL_THESAURUS = "http://words.bighugelabs.com/api/2/%s/%s/json"
-
class Module(object):
def __init__(self, bot):
self.bot = bot
bot.events.on("received").on("command").on("synonym",
- "antonym").hook(
- self.thesaurus, min_args=1,
+ "antonym").hook(self.thesaurus, min_args=1,
help="Get synonyms/antonyms for a provided phrase",
usage="<word> [type]")
def thesaurus(self, event):
phrase = event["args_split"][0]
page = Utils.get_url(URL_THESAURUS % (self.bot.config[
- "bighugethesaurus-api-key"],
- phrase), json=True)
+ "bighugethesaurus-api-key"], phrase), json=True)
syn_ant = event["command"][:3]
if page:
if not len(event["args_split"]) > 1:
@@ -30,7 +27,7 @@ class Module(object):
word_types = sorted(word_types)
event["stdout"].write(
"Available categories for %s: %s" % (
- phrase, ", ".join(word_types)))
+ phrase, ", ".join(word_types)))
else:
event["stderr"].write("No categories available")
else:
@@ -39,7 +36,7 @@ class Module(object):
if syn_ant in page[category]:
event["stdout"].write("%ss for %s: %s" % (
event["command"].title(), phrase, ", ".join(
- page[category][syn_ant])))
+ page[category][syn_ant])))
else:
event["stderr"].write("No %ss for %s" % (
event["command"], phrase))