aboutsummaryrefslogtreecommitdiff
path: root/modules/weather.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-04-28 15:38:26 +0100
committerGravatar jesopo2019-04-28 15:38:26 +0100
commit3fce209a997914e596740104e47895e2ddd12ebb (patch)
tree15b5faa64a5b9d1c9e33223ff3619426c8fbd3be /modules/weather.py
parentAdd !w as an alias of !weather (diff)
signature
Change location.py to use lat/lon instead of continent/country/city
Diffstat (limited to 'modules/weather.py')
-rw-r--r--modules/weather.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/weather.py b/modules/weather.py
index 4f4bb913..e97feade 100644
--- a/modules/weather.py
+++ b/modules/weather.py
@@ -8,7 +8,7 @@ class Module(ModuleManager.BaseModule):
def _user_location(self, user):
user_location = user.get_setting("location", None)
if not user_location == None:
- return "%s, %s" % (user_location["city"], user_location["country"])
+ return [user_location["lat"], user_location["lon"]]
@utils.hook("received.command.w", alias_of="weather")
@utils.hook("received.command.weather")
@@ -31,9 +31,9 @@ class Module(ModuleManager.BaseModule):
if location == None:
raise utils.EventError("You don't have a location set")
+ lat, lon = location
page = utils.http.request(URL_WEATHER, get_params={
- "q": location, "units": "metric",
- "APPID": api_key},
+ "units": "metric", "lat": lat, "lon": lon, "APPID": api_key},
json=True)
if page:
if "weather" in page.data: