aboutsummaryrefslogtreecommitdiff
path: root/modules/weather.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/weather.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/weather.py')
-rw-r--r--modules/weather.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/weather.py b/modules/weather.py
index e79d1ad8..f16b62b7 100644
--- a/modules/weather.py
+++ b/modules/weather.py
@@ -7,11 +7,12 @@ URL_WEATHER = "http://api.openweathermap.org/data/2.5/weather"
class Module(object):
def __init__(self, bot, events, exports):
self.bot = bot
- events.on("received.command.weather").hook(self.weather, min_args=1,
- help="Get current weather data for a provided location",
- usage="<location>")
+ @Utils.hook("received.command.weather", min_args=1, usage="<location>")
def weather(self, event):
+ """
+ Get current weather data for a provided location
+ """
api_key = self.bot.config["openweathermap-api-key"]
page = Utils.get_url(URL_WEATHER, get_params={
"q": event["args"], "units": "metric",