diff options
| author | 2018-09-26 18:27:17 +0100 | |
|---|---|---|
| committer | 2018-09-26 18:27:17 +0100 | |
| commit | 51a52e2b0e54031cce5876f54d1d48c268b5441c (patch) | |
| tree | a4c0e8e86c55aa701b06297d5b5a2ceebeaab60d /modules/geoip.py | |
| parent | Also 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/geoip.py')
| -rw-r--r-- | modules/geoip.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/modules/geoip.py b/modules/geoip.py index 5bc464b1..f20df6aa 100644 --- a/modules/geoip.py +++ b/modules/geoip.py @@ -1,14 +1,15 @@ -from src import Utils +from src import ModuleManager, Utils URL_GEOIP = "http://ip-api.com/json/%s" -class Module(object): +class Module(ModuleManager.BaseModule): _name = "GeoIP" - def __init__(self, bot, events, exports): - events.on("received.command.geoip").hook(self.geoip, min_args=1, - help="Get geoip data on a given IPv4/IPv6 address", usage="<IP>") + @Utils.hook("received.command.geoip", min_args=1, usage="<IP>") def geoip(self, event): + """ + Get geoip data on a given IPv4/IPv6 address + """ page = Utils.get_url(URL_GEOIP % event["args_split"][0], json=True) if page: |
