diff options
| author | 2018-09-26 18:27:17 +0100 | |
|---|---|---|
| committer | 2018-09-26 18:27:17 +0100 | |
| commit | 51a52e2b0e54031cce5876f54d1d48c268b5441c (patch) | |
| tree | a4c0e8e86c55aa701b06297d5b5a2ceebeaab60d /modules/wikipedia.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/wikipedia.py')
| -rw-r--r-- | modules/wikipedia.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/modules/wikipedia.py b/modules/wikipedia.py index ffe9473d..f668b8ca 100644 --- a/modules/wikipedia.py +++ b/modules/wikipedia.py @@ -1,14 +1,13 @@ -from src import Utils +from src import ModuleManager, Utils URL_WIKIPEDIA = "https://en.wikipedia.org/w/api.php" -class Module(object): - def __init__(self, bot, events, exports): - self.bot = bot - events.on("received.command").on("wiki", "wi" - ).hook(self.wikipedia, min_args=1) - +class Module(ModuleManager.BaseModule): + @Utils.hook("received.command.wiki|wi", min_args=1) def wikipedia(self, event): + """ + Get information from wikipedia + """ page = Utils.get_url(URL_WIKIPEDIA, get_params={ "action": "query", "prop": "extracts", "titles": event["args"], "exintro": "", |
