more appropriate weather emojis

This commit is contained in:
Shihaam Abdul Rahman 2023-11-14 00:23:13 +05:00
parent 60d03dbb13
commit b69df2c87f
Signed by untrusted user: shihaam
GPG Key ID: 6DA2E87EBC227636

61
bot.sh
View File

@ -104,37 +104,52 @@ googledns_ping=$(latency 8.8.8.8)
echo Checking weather echo Checking weather
# Make the API request # Make the API request
curl -s "https://api.open-meteo.com/v1/forecast?latitude=${LATITUDE}&longitude=${LONGITUDE}&current_weather=true" > $weather_file curl -s "https://api.open-meteo.com/v1/forecast?latitude=${LATITUDE}&longitude=${LONGITUDE}&current_weather=true" > $weather_file
# Extract Weather Condition # Extract Weather Condition and day or not
weather_condition=$(cat $weather_file | jq '.current_weather.weathercode') weather_condition=$(jq '.current_weather.weathercode' "$weather_file")
is_day=$(jq '.current_weather.is_day' "$weather_file")
case $weather_condition in case $weather_condition in
0) current_weather="☀️ Clear Sky" ;; 0)
1) current_weather="☀️ Mainly Clear" ;; if [ "$is_day" = "1" ]
then
current_weather="☀️ Clear Sky"
else
current_weather="🌙 Clear Sky"
fi
;;
1)
if [ "$is_day" = "1" ]
then
current_weather="☀️ Mainly Clear"
else
current_weather="🌙 Mainly Clear"
fi
;;
2) current_weather="⛅ Partly Cloudy" ;; 2) current_weather="⛅ Partly Cloudy" ;;
3) current_weather="☁️ Overcast" ;; 3) current_weather="☁️ Overcast" ;;
45) current_weather="🌫️ Fog" ;; 45) current_weather="🌫️ Fog" ;;
48) current_weather="🌫️🌬️ Depositing Rime Fog" ;; 48) current_weather="🌫️🌬️ Depositing Rime Fog" ;;
51) current_weather="🌦️💧 Light Drizzle" ;; 51) current_weather="🌦️💧 Light Drizzle" ;;
53) current_weather="🌦️💧 Moderate Drizzle" ;; 53) current_weather="🌦️💧 Moderate Drizzle" ;;
55) current_weather="🌦️💧 Dense Drizzle" ;; 55) current_weather="🌦️💧 Dense Drizzle" ;;
56) current_weather="🌦️❄️ Light Freezing Drizzle" ;; 56) current_weather="🌦️❄️ Light Freezing Drizzle" ;;
57) current_weather="🌦️❄️ Dense Freezing Drizzle" ;; 57) current_weather="🌦️❄️ Dense Freezing Drizzle" ;;
61) current_weather="🌧️ Slight Rain" ;; 61) current_weather="🌧️ Slight Rain" ;;
63) current_weather="🌧️ Moderate Rain" ;; 63) current_weather="🌧️ Moderate Rain" ;;
65) current_weather="🌧️ Heavy Rain" ;; 65) current_weather="🌧️ Heavy Rain" ;;
66) current_weather="🌧️❄️ Light Freezing Rain" ;; 66) current_weather="🌧️❄️ Light Freezing Rain" ;;
67) current_weather="🌧️❄️ Heavy Freezing Rain" ;; 67) current_weather="🌧️❄️ Heavy Freezing Rain" ;;
71) current_weather="🌨️ Slight Snowfall" ;; 71) current_weather="🌨️ Slight Snowfall" ;;
73) current_weather="🌨️ Moderate Snowfall" ;; 73) current_weather="🌨️ Moderate Snowfall" ;;
75) current_weather="🌨️ Heavy Snowfall" ;; 75) current_weather="🌨️ Heavy Snowfall" ;;
77) current_weather="❄️ Snow Grains" ;; 77) current_weather="❄️ Snow Grains" ;;
80) current_weather="🌧️🚿 Slight Rain Showers" ;; 80) current_weather="🌧️🚿 Slight Rain Showers" ;;
81) current_weather="🌧️🚿 Moderate Rain Showers" ;; 81) current_weather="🌧️🚿 Moderate Rain Showers" ;;
82) current_weather="🌧️🚿 Violent Rain Showers" ;; 82) current_weather="🌧️🚿 Violent Rain Showers" ;;
85) current_weather="🌨️❄️ Slight Snow Showers" ;; 85) current_weather="🌨️❄️ Slight Snow Showers" ;;
86) current_weather="🌨️❄️ Heavy Snow Showers" ;; 86) current_weather="🌨️❄️ Heavy Snow Showers" ;;
95) current_weather="⛈️ Slight Thunderstorm" ;; 95) current_weather="⛈️ Slight Thunderstorm" ;;
96) current_weather="⛈️🌨️ Thunderstorm with Slight Hail" ;; 96) current_weather="⛈️🌨️ Thunderstorm with Slight Hail" ;;
99) current_weather="⛈️🌨️ Thunderstorm with Heavy Hail" ;; 99) current_weather="⛈️🌨️ Thunderstorm with Heavy Hail" ;;
*) current_weather="🌐 Weather Condition Not Recognized" ;; *) current_weather="🌐 Weather Condition Not Recognized" ;;
esac esac
echo Weather checked echo Weather checked