diff options
| author | 2018-10-03 13:22:37 +0100 | |
|---|---|---|
| committer | 2018-10-03 13:22:37 +0100 | |
| commit | 69d58eede2e9bf83aa1ed1d8fcf956efde494726 (patch) | |
| tree | 11aa30f2a357f3be23ad97315dae3df051455cbe /modules/define.py | |
| parent | Add a way to not add a user automatically in IRCServer.get_user (diff) | |
| signature | ||
Move src/Utils.py in to src/utils/, splitting functionality out in to modules of
related functionality
Diffstat (limited to 'modules/define.py')
| -rw-r--r-- | modules/define.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/define.py b/modules/define.py index dbd1e420..f0d696d0 100644 --- a/modules/define.py +++ b/modules/define.py @@ -1,7 +1,7 @@ #--require-config wordnik-api-key import time -from src import ModuleManager, Utils +from src import ModuleManager, utils URL_WORDNIK = "https://api.wordnik.com/v4/word.json/%s/definitions" URL_WORDNIK_RANDOM = "https://api.wordnik.com/v4/words.json/randomWord" @@ -12,14 +12,14 @@ class Module(ModuleManager.BaseModule): _last_called = 0 def _get_definition(self, word): - page = Utils.get_url(URL_WORDNIK % word, get_params={ + page = utils.http.get_url(URL_WORDNIK % word, get_params={ "useCanonical": "true", "limit": 1, "sourceDictionaries": "wiktionary", "api_key": self.bot.config[ "wordnik-api-key"]}, json=True) return page - @Utils.hook("received.command.define") + @utils.hook("received.command.define") def define(self, event): """ :help: Define a provided term @@ -40,7 +40,7 @@ class Module(ModuleManager.BaseModule): else: event["stderr"].write("Failed to load results") - @Utils.hook("received.command.randomword") + @utils.hook("received.command.randomword") def random_word(self, event): """ :help: Define a random word @@ -49,7 +49,7 @@ class Module(ModuleManager.BaseModule): RANDOM_DELAY_SECONDS): self._last_called = time.time() - page = Utils.get_url(URL_WORDNIK_RANDOM, get_params={ + page = utils.http.get_url(URL_WORDNIK_RANDOM, get_params={ "api_key":self.bot.config["wordnik-api-key"], "min_dictionary_count":1},json=True) if page and len(page): |
