parent
48f9e5b1b8
commit
5c07d18682
1 changed files with 30 additions and 0 deletions
30
cc/weather
Normal file
30
cc/weather
Normal file
|
@ -0,0 +1,30 @@
|
|||
import requests, os, sys
|
||||
if "WAPIKEY" in os.environ:
|
||||
print("MeowNexUS requires the WAPIKEY environment variable for this command to function.")
|
||||
sys.exit(1)
|
||||
query = requests.get("http://api.weatherapi.com/v1/current.json?key=" + os.environ["WAPIKEY"] + "&q=" + " ".join(sys.argv[3:])).json()
|
||||
weathers = {
|
||||
1: {
|
||||
1000: "☀️",
|
||||
1003: "⛅",
|
||||
1006: "☁️",
|
||||
1009: "☁️",
|
||||
1030: "🌫️",
|
||||
1063: "🌦️",
|
||||
**dict.fromkeys([1063, 1150, 1153, 1180, 1183, 1186, 1189, 1192, 1195, 1198, 1201, 1204, 1207, 1240, 1243, 1246, 1249, 1252], "🌧️"),
|
||||
**dict.fromkeys([1063, 1150, 1153], "🌨️")
|
||||
},
|
||||
0: {
|
||||
1000: "🌙",
|
||||
1003: "☁️",
|
||||
1006: "☁️",
|
||||
1009: "☁️",
|
||||
1030: "🌫️",
|
||||
**dict.fromkeys([1063, 1150, 1153, 1180, 1183, 1186, 1189, 1192, 1195, 1198, 1201, 1204, 1207, 1240, 1243, 1246, 1249, 1252], "🌧️"),
|
||||
**dict.fromkeys([1063, 1150, 1153], "🌨️")
|
||||
}
|
||||
}
|
||||
if "error" in query:
|
||||
print("API ERROR: " + query["error"]["message"])
|
||||
else:
|
||||
print("")
|
Loading…
Add table
Reference in a new issue