diff --git a/bot.sh b/bot.sh index b16bfde..2cd5d8a 100755 --- a/bot.sh +++ b/bot.sh @@ -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" ;; diff --git a/day.sh b/day.sh new file mode 100644 index 0000000..188e676 --- /dev/null +++ b/day.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +weather_condition=1 +is_day=1 + +#swap_emoji(){ +#if [ "$is_day" = "1" ] +#then +# echo "☀️ " +#else +# echo "🌙" +#fi +#} +#swap_emoji() { [ "$is_day" = "1" ] && echo "☀️" || echo "🌙"; } +case $weather_condition in + 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" ;; + 99) current_weather="⛈️🌨️ Thunderstorm with Heavy Hail" ;; + *) current_weather="🌐 Weather Condition Not Recognized" ;; +esac + +echo $current_weather diff --git a/var.sh b/var.sh new file mode 100644 index 0000000..4797c00 --- /dev/null +++ b/var.sh @@ -0,0 +1,9 @@ + + +var(){ + echo var +} +bruh="$(var) bruh" + + +echo $bruh