aboutsummaryrefslogtreecommitdiff
path: root/modules/wikipedia.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/wikipedia.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/wikipedia.py')
-rw-r--r--modules/wikipedia.py13
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": "",