aboutsummaryrefslogtreecommitdiff
path: root/modules/haveibeenpwned.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/haveibeenpwned.py
parentAlso use docstrings to check if a command has help available, allow one-string (diff)
Switch to using @Utils.hook and docstrings for event hooks
Diffstat (limited to 'modules/haveibeenpwned.py')
-rw-r--r--modules/haveibeenpwned.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/modules/haveibeenpwned.py b/modules/haveibeenpwned.py
index 79662913..0a328c3e 100644
--- a/modules/haveibeenpwned.py
+++ b/modules/haveibeenpwned.py
@@ -1,15 +1,16 @@
-from src import Utils
+from src import ModuleManager, Utils
URL_HAVEIBEENPWNEDAPI = "https://haveibeenpwned.com/api/v2/breachedaccount/%s"
URL_HAVEIBEENPWNED = "https://haveibeenpwned.com/"
-class Module(object):
- def __init__(self, bot, events, exports):
- events.on("received.command.beenpwned").hook(self.beenpwned,
- help="Find out if a username, email or similar has appeared "
- "in any hacked databases", usage="<username/email>", min_args=1)
-
+class Module(ModuleManager.BaseModule):
+ @Utils.hook("received.command.beenpwned", usage="<username/email>",
+ min_args=1)
def beenpwned(self, event):
+ """
+ Find out if a username, email or similar has appeared in any
+ hacked databases
+ """
page = Utils.get_url(URL_HAVEIBEENPWNEDAPI % event["args"], json=True,
code=True)
if page: