slightly cleaner code

This commit is contained in:
2023-11-14 01:02:32 +05:00
parent b69df2c87f
commit c6e4b5c26a
3 changed files with 36 additions and 16 deletions

18
bot.sh
View File

@ -108,22 +108,8 @@ curl -s "https://api.open-meteo.com/v1/forecast?latitude=${LATITUDE}&longitude=$
weather_condition=$(jq '.current_weather.weathercode' "$weather_file")
is_day=$(jq '.current_weather.is_day' "$weather_file")
case $weather_condition in
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
;;
0) current_weather="$([ "$is_day" = "1" ] && echo "☀️" || echo "🌙") Clear Sky";;
1) current_weather="$([ "$is_day" = "1" ] && echo "☀️" || echo "🌙") Mainly Clear";;
2) current_weather="⛅ Partly Cloudy" ;;
3) current_weather="☁️ Overcast" ;;
45) current_weather="🌫️ Fog" ;;