Nieuwe coronastats

This commit is contained in:
2021-04-07 22:15:56 +02:00
parent 3b26e80bb8
commit 7666932ff1
+25 -1
View File
@@ -122,7 +122,7 @@ class Shitpost(commands.Cog):
@commands.command(pass_context=True, hidden=False) @commands.command(pass_context=True, hidden=False)
@asyncio.coroutine @asyncio.coroutine
def corona(self, ctx): def coronaold(self, ctx):
try: try:
yield from ctx.message.delete() yield from ctx.message.delete()
except: except:
@@ -141,6 +141,30 @@ class Shitpost(commands.Cog):
message += "Ook liggen er " + str(answer[0]["critical"]) + " mensen op de IC 🏥" message += "Ook liggen er " + str(answer[0]["critical"]) + " mensen op de IC 🏥"
yield from ctx.channel.send(ctx.author.mention + ' ' + str(message)) yield from ctx.channel.send(ctx.author.mention + ' ' + str(message))
@commands.command(pass_context=True, hidden=False)
@asyncio.coroutine
def corona(self, ctx):
try:
yield from ctx.message.delete()
except:
print("No permission to delete message")
params = (
('minimal/', 'true'),
('format/', 'json')
)
response = requests.get('https://covid.ourworldindata.org/data/latest/owid-covid-latest.json')
answer = json.loads(response.content.decode('utf-8'))
d = answer["NLD"]
message = f"Dit is mijn informatie van **{d['last_updated_date']}**: \n\n"
message += f"Er zijn in Nederland {d['total_cases']:.0f} bevestigde gevallen 😷"
message += f" dat is 🔺{d['new_cases']:.0f}🔺 meer dan de dag er voor! \n"
message += f"Er zijn ondertussen {d['total_deaths']:.0f} mensen dood 💀"
message += f" waarvan {d['new_deaths']:.0f} ☠️ in de meest recente 24 uur. \n"
message += f"Er zijn ondertussen {d['people_vaccinated']:.0f} mensen gevaccineerd! 💉 "
message += f"En het r-getal is {d['reproduction_rate']}!\n\n"
message += "*Data van https://ourworldindata.org/coronavirus*"
yield from ctx.channel.send(ctx.author.mention + ' ' + str(message))
@commands.command(pass_context=True, hidden=False) @commands.command(pass_context=True, hidden=False)
@asyncio.coroutine @asyncio.coroutine
def viertwintig(self, ctx): def viertwintig(self, ctx):