output weather to file, added spaces
This commit is contained in:
parent
1e627b0bad
commit
31e961529a
18
bot.sh
18
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
|
||||
#################################################################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user