New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
time & weather: fix inconsistency #179
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,16 +41,15 @@ async def get_weather(weather): | |
return | ||
|
||
if len(OWM_API) < 1: | ||
await weather.edit("Get an API key from " | ||
"https://openweathermap.org/ first.") | ||
await weather.edit("`Get an API key from` https://openweathermap.org/ `first.`") | ||
return | ||
|
||
APPID = OWM_API | ||
|
||
if not weather.pattern_match.group(1): | ||
CITY = DEFCITY | ||
if not CITY: | ||
await weather.edit("Please specify a city or set one as default.") | ||
await weather.edit("`Please specify a city or set one as default.`") | ||
return | ||
else: | ||
CITY = weather.pattern_match.group(1) | ||
|
@@ -68,7 +67,7 @@ async def get_weather(weather): | |
try: | ||
countrycode = timezone_countries[f'{country}'] | ||
except KeyError: | ||
await weather.edit("Invalid country.") | ||
await weather.edit("`Invalid country.`") | ||
return | ||
CITY = newcity[0].strip() + "," + countrycode.strip() | ||
|
||
|
@@ -77,7 +76,7 @@ async def get_weather(weather): | |
result = json.loads(request.text) | ||
|
||
if request.status_code != 200: | ||
await weather.edit(f"{result['message']}") | ||
await weather.edit(f"`Invalid country.`") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have it there to tell what msg the page give out alongside 200 error. |
||
return | ||
|
||
cityname = result['name'] | ||
|
@@ -139,7 +138,7 @@ async def set_default_city(city): | |
return | ||
|
||
if len(OWM_API) < 1: | ||
await city.edit("Get an API key from https://openweathermap.org/ first.") | ||
await city.edit("`Get an API key from` https://openweathermap.org/ `first.`") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lint this. |
||
return | ||
|
||
global DEFCITY | ||
|
@@ -148,7 +147,7 @@ async def set_default_city(city): | |
if not city.pattern_match.group(1): | ||
CITY = DEFCITY | ||
if not CITY: | ||
await city.edit("Please specify a city to set one as default.") | ||
await city.edit("`Please specify a city to set one as default.`") | ||
return | ||
else: | ||
CITY = city.pattern_match.group(1) | ||
|
@@ -166,7 +165,7 @@ async def set_default_city(city): | |
try: | ||
countrycode = timezone_countries[f'{country}'] | ||
except KeyError: | ||
await city.edit("Invalid country.") | ||
await city.edit("`Invalid country.`") | ||
return | ||
CITY = newcity[0].strip() + "," + countrycode.strip() | ||
|
||
|
@@ -175,7 +174,7 @@ async def set_default_city(city): | |
result = json.loads(request.text) | ||
|
||
if request.status_code != 200: | ||
await city.edit(f"{result['message']}") | ||
await city.edit(f"`Invalid country.`") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have it there to tell what msg the page give out alongside 200 error. |
||
return | ||
|
||
DEFCITY = CITY | ||
|
@@ -184,7 +183,7 @@ async def set_default_city(city): | |
|
||
fullc_n = c_n[f"{country}"] | ||
|
||
await city.edit(f"Set default city as {cityname}, {fullc_n}.") | ||
await city.edit(f"`Set default city as {cityname}, {fullc_n}.`") | ||
|
||
|
||
CMD_HELP.update({ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to even edit this line...