mirror of https://github.com/stijndcl/didier
Catch keyerror for corona vaccines
parent
c84cb3f944
commit
13df55ac53
|
@ -32,7 +32,10 @@ class Corona(commands.Cog):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Vaccination stats
|
# Vaccination stats
|
||||||
vaccine = self.getVaccineData(country, dic["today"]["population"], dic["yesterday"]["population"])
|
try:
|
||||||
|
vaccine = self.getVaccineData(country, dic["today"]["population"], dic["yesterday"]["population"])
|
||||||
|
except KeyError:
|
||||||
|
vaccine = None
|
||||||
|
|
||||||
await self.sendEmbed(ctx, dic, vaccine)
|
await self.sendEmbed(ctx, dic, vaccine)
|
||||||
|
|
||||||
|
@ -210,6 +213,11 @@ class Corona(commands.Cog):
|
||||||
embed.add_field(name="Aantal toegediende vaccins:",
|
embed.add_field(name="Aantal toegediende vaccins:",
|
||||||
value="{:,}".format(vaccines["today"]["vaccines"]),
|
value="{:,}".format(vaccines["today"]["vaccines"]),
|
||||||
inline=False)
|
inline=False)
|
||||||
|
else:
|
||||||
|
# Vaccine data is missing
|
||||||
|
embed.add_field(name="Aantal toegediende vaccins:",
|
||||||
|
value="?",
|
||||||
|
inline=False)
|
||||||
|
|
||||||
# Timestamp of last update
|
# Timestamp of last update
|
||||||
timeFormatted = timeFormatters.epochToDate(int(dic["today"]["updated"]) / 1000)
|
timeFormatted = timeFormatters.epochToDate(int(dic["today"]["updated"]) / 1000)
|
||||||
|
|
Loading…
Reference in New Issue