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

23
bot.sh
View File

@ -104,11 +104,26 @@ googledns_ping=$(latency 8.8.8.8)
echo Checking weather
# Make the API request
curl -s "https://api.open-meteo.com/v1/forecast?latitude=${LATITUDE}&longitude=${LONGITUDE}&current_weather=true" > $weather_file
# Extract Weather Condition
weather_condition=$(cat $weather_file | jq '.current_weather.weathercode')
# Extract Weather Condition and day or not
weather_condition=$(jq '.current_weather.weathercode' "$weather_file")
is_day=$(jq '.current_weather.is_day' "$weather_file")
case $weather_condition in
0) current_weather="☀️ Clear Sky" ;;
1) current_weather="☀️ Mainly Clear" ;;
0)
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" ;;
3) current_weather="☁️ Overcast" ;;
45) current_weather="🌫️ Fog" ;;