7 Commits

Author SHA1 Message Date
72c474e97f add wind speed for !vreme 2024-03-04 14:44:23 +01:00
d52b4ac5e5 fix !vreme for spaces in cities 2024-03-04 11:45:57 +01:00
690239bb86 fix typo in !vreme 2024-03-04 11:32:37 +01:00
b416e04a9a fix !vreme issue with wrong number of arguments 2024-03-04 11:28:32 +01:00
f2b288fa30 fix youtube link change 2024-02-18 15:44:12 +01:00
145114320c add www to youtube in frontends 2024-02-09 12:52:20 +01:00
4485d15740 Merge pull request 'Frontendi dodatni' (#3) from dev into master
Reviewed-on: #3
2024-02-09 11:16:50 +00:00
3 changed files with 10 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
FRONTENDS = {
"youtube.com/watch": ("iv.datura.network", "inv.tux.pizza"),
"www.youtube.com/watch": ("iv.datura.network/watch", "inv.tux.pizza/watch"),
"youtube.com/watch": ("iv.datura.network/watch", "inv.tux.pizza/watch"),
"medium.com" : ("scribe.rip", "sc.vern.cc", "m.opnxng.com"),
"stackoverflow.com": ("code.whatever.social", "ao.vern.cc", "overflow.smnz.de"),
"instagram.com": ("bibliogram.1d4.us", "bibliogram.froth.zone", "ig.opnxng.com", "proxigram.lunar.icu"),

View File

@@ -32,6 +32,9 @@ def command(msg, rcpt):
content = sf.getDmzTasks("https://todo.dmz.rs/")
return content
elif msg.startswith("!vreme") or msg.startswith("!prognoza") or msg.startswith("!weather"):
_, query = msg.split(" ", 1)
commandsplit = msg.split(" ", 1)
if len(commandsplit) == 1:
return sf.get_weather("Beograd")
else:
query = commandsplit[1]
return sf.get_weather(query)

View File

@@ -50,8 +50,8 @@ def getDmzTasks(url):
return e
def get_weather(city:str) -> str:
url = f"https://wttr.in/{city}?format=3"
if not city.isalpha():
url = f"https://wttr.in/{city}?format=4"
if not city.replace(" ","").isalpha():
return "no such city"
resp = requests.get(url)
return resp.content.decode("utf-8").strip()