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
|
||||
|
||||
# Vaccination stats
|
||||
try:
|
||||
vaccine = self.getVaccineData(country, dic["today"]["population"], dic["yesterday"]["population"])
|
||||
except KeyError:
|
||||
vaccine = None
|
||||
|
||||
await self.sendEmbed(ctx, dic, vaccine)
|
||||
|
||||
|
@ -210,6 +213,11 @@ class Corona(commands.Cog):
|
|||
embed.add_field(name="Aantal toegediende vaccins:",
|
||||
value="{:,}".format(vaccines["today"]["vaccines"]),
|
||||
inline=False)
|
||||
else:
|
||||
# Vaccine data is missing
|
||||
embed.add_field(name="Aantal toegediende vaccins:",
|
||||
value="?",
|
||||
inline=False)
|
||||
|
||||
# Timestamp of last update
|
||||
timeFormatted = timeFormatters.epochToDate(int(dic["today"]["updated"]) / 1000)
|
||||
|
|
Loading…
Reference in New Issue