From 31e961529aeaa1abb4e00615b8762e09575d6c04 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 11 Nov 2023 23:24:02 +0500 Subject: [PATCH] output weather to file, added spaces --- bot.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bot.sh b/bot.sh index 74338e6..9b9cf04 100755 --- a/bot.sh +++ b/bot.sh @@ -23,18 +23,18 @@ upload_speed=$(grep -oP 'Upload: \K.*(?= Mbit/s)' $speedtest_result) ################################################################################# # Make the API request -response=$(curl -s "https://api.open-meteo.com/v1/forecast?latitude=${LATITUDE}&longitude=${LONGITUDE}¤t_weather=true" > $weather_file) +curl -s "https://api.open-meteo.com/v1/forecast?latitude=${LATITUDE}&longitude=${LONGITUDE}¤t_weather=true" > $weather_file # Extract Weather Condition weather_condition=$(cat $weather_file | jq '.current_weather.weathercode') case $weather_condition in - 0) current_weather="☀️ Clear sky" ;; - 1|2|3) current_weather="☁️ Cloudy" ;; - 45|48) current_weather="🌫️ Fog" ;; - 51|53|55|56|57) current_weather="🌧️ Drizzle" ;; - 61|63|65|66|67) current_weather="🌦️ Rain" ;; - 80|81|82) current_weather="🌧️ Rain showers" ;; - 85|86) current_weather="🌨️ Snow showers" ;; - 95|96|99) current_weather="⛈️ Thunderstorm" ;; + 0) current_weather="☀️ Clear sky" ;; + 1|2|3) current_weather="☁️ Cloudy" ;; + 45|48) current_weather="🌫️ Fog" ;; + 51|53|55|56|57) current_weather="🌧️ Drizzle" ;; + 61|63|65|66|67) current_weather="🌦️ Rain" ;; + 80|81|82) current_weather="🌧️ Rain showers" ;; + 85|86) current_weather="🌨️ Snow showers" ;; + 95|96|99) current_weather="⛈️ Thunderstorm" ;; *) current_weather="🌐 Weather condition not recognized" ;; esac #################################################################################