diff --git a/cogs/corona.py b/cogs/corona.py index 9cd35cc..82f93fa 100644 --- a/cogs/corona.py +++ b/cogs/corona.py @@ -32,7 +32,10 @@ class Corona(commands.Cog): return # 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) @@ -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)