Compare commits
No commits in common. "d52b4ac5e5f3e2af84bbbeffce465ffb0d5b0fe9" and "f2b288fa30cf64009f787b8022a7da414648dd32" have entirely different histories.
d52b4ac5e5
...
f2b288fa30
@ -32,9 +32,6 @@ def command(msg, rcpt):
|
|||||||
content = sf.getDmzTasks("https://todo.dmz.rs/")
|
content = sf.getDmzTasks("https://todo.dmz.rs/")
|
||||||
return content
|
return content
|
||||||
elif msg.startswith("!vreme") or msg.startswith("!prognoza") or msg.startswith("!weather"):
|
elif msg.startswith("!vreme") or msg.startswith("!prognoza") or msg.startswith("!weather"):
|
||||||
commandsplit = msg.split(" ", 1)
|
_, query = msg.split(" ", 1)
|
||||||
if len(commandsplit) == 1:
|
|
||||||
return sf.get_weather("Beograd")
|
|
||||||
else:
|
|
||||||
query = commandsplit[1]
|
|
||||||
return sf.get_weather(query)
|
return sf.get_weather(query)
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ def getDmzTasks(url):
|
|||||||
|
|
||||||
def get_weather(city:str) -> str:
|
def get_weather(city:str) -> str:
|
||||||
url = f"https://wttr.in/{city}?format=3"
|
url = f"https://wttr.in/{city}?format=3"
|
||||||
if not city.replace(" ","").isalpha():
|
if not city.isalpha():
|
||||||
return "no such city"
|
return "no such city"
|
||||||
resp = requests.get(url)
|
resp = requests.get(url)
|
||||||
return resp.content.decode("utf-8").strip()
|
return resp.content.decode("utf-8").strip()
|
||||||
|
Loading…
Reference in New Issue
Block a user