From 892ca5a843593f23916884ab52a95b152494860d Mon Sep 17 00:00:00 2001 From: JP Date: Tue, 16 Jun 2020 18:41:40 +0200 Subject: [PATCH] Gettin real tired of your shit weather API... --- Shitpost.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Shitpost.py b/Shitpost.py index 7de781e..b7bee64 100644 --- a/Shitpost.py +++ b/Shitpost.py @@ -587,10 +587,17 @@ class Shitpost(commands.Cog): #add up to 4.0 points for sun: grade += float(weatherObj["d0zon"]) / 25 #add up to 5.0 points for temperature: - grade += min(5.0, float(weatherObj["d0tmax"])*float(weatherObj["d0tmax"])/130) + grade += min(5.0, float(weatherObj["gtemp"])*float(weatherObj["d0tmax"])/100) #remove up to 5.0 points for rain/snow: grade -= float(weatherObj["d0neerslag"]) / 20 + #but since d0neerslag is very unreliable: + if float(weatherObj["d0neerslag"]) < 10: + if weatherObj["image"] in ["regen", "buien", "bliksem", "hagel", "sneeuw", "halfbewolkt_regen"]: + grade -= 2.0 + elif "regen" in weatherObj["verw"] or "buien" in weatherObj["verw"]: + grade -= 1.5 + #remove points for very hot weather: (above 30) grade -= max(0, (float(weatherObj["d0tmax"]) - 30.0)/3 ) except: