diff options
| author | 2019-06-18 16:40:42 +0100 | |
|---|---|---|
| committer | 2019-06-18 16:40:42 +0100 | |
| commit | 14303f354c71b4ce57f84d953bf727014e91ebae (patch) | |
| tree | c61d54381b6570b52caad2202cfc0be62f22ab84 | |
| parent | Save location name from geocoding, use it for !w when available (diff) | |
| signature | ||
'location' wasn't the variable i thought it was
| -rw-r--r-- | modules/weather.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/weather.py b/modules/weather.py index aa93d7f4..263bc07d 100644 --- a/modules/weather.py +++ b/modules/weather.py @@ -10,7 +10,8 @@ class Module(ModuleManager.BaseModule): def _user_location(self, user): user_location = user.get_setting("location", None) if not user_location == None: - return [user_location["lat"], user_location["lon"]] + name = user_location.get("name", None) + return [user_location["lat"], user_location["lon"], name] @utils.hook("received.command.w", alias_of="weather") @utils.hook("received.command.weather") @@ -40,7 +41,7 @@ class Module(ModuleManager.BaseModule): args = {"units": "metric", "APPID": api_key} if location: - lat, lon = location + lat, lon, location_name = location args["lat"] = lat args["lon"] = lon else: @@ -49,8 +50,8 @@ class Module(ModuleManager.BaseModule): page = utils.http.request(URL_WEATHER, get_params=args, json=True) if page: if "weather" in page.data: - if "name" in location: - location_str = location["name"] + if location_name: + location_str = location_name else: location_parts = [page.data["name"]] if "country" in page.data["sys"]: |
