diff options
| author | 2018-12-11 22:26:38 +0000 | |
|---|---|---|
| committer | 2018-12-11 22:26:38 +0000 | |
| commit | 793d234a0b924c0330e88f07f68b13559b42e4ac (patch) | |
| tree | 90ecd3746a77e17da915f90ec057cb16ead82c05 /modules/thesaurus.py | |
| parent | Actually use `action_desc` in github.py.issues, so that we can see what things (diff) | |
| signature | ||
'utils.http.get_url' -> 'utils.http.request', return a Response object from
utils.http.request
Diffstat (limited to 'modules/thesaurus.py')
| -rw-r--r-- | modules/thesaurus.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/thesaurus.py b/modules/thesaurus.py index 619df439..ac58be8c 100644 --- a/modules/thesaurus.py +++ b/modules/thesaurus.py @@ -12,14 +12,14 @@ class Module(ModuleManager.BaseModule): :usage: <word> [type] """ phrase = event["args_split"][0] - page = utils.http.get_url(URL_THESAURUS % (self.bot.config[ + page = utils.http.request(URL_THESAURUS % (self.bot.config[ "bighugethesaurus-api-key"], phrase), json=True) syn_ant = event["command"][:3] if page: if not len(event["args_split"]) > 1: word_types = [] - for word_type in page.keys(): - if syn_ant in page[word_type]: + for word_type in page.data.keys(): + if syn_ant in page.data[word_type]: word_types.append(word_type) if word_types: word_types = sorted(word_types) @@ -30,11 +30,11 @@ class Module(ModuleManager.BaseModule): event["stderr"].write("No categories available") else: category = event["args_split"][1].lower() - if category in page: - if syn_ant in page[category]: + if category in page.data: + if syn_ant in page.data[category]: event["stdout"].write("%ss for %s: %s" % ( event["command"].title(), phrase, ", ".join( - page[category][syn_ant]))) + page.data[category][syn_ant]))) else: event["stderr"].write("No %ss for %s" % ( event["command"], phrase)) |
