23 lines
868 B
Python
23 lines
868 B
Python
#!/bin/python
|
|
|
|
try:
|
|
from parse_data import update_data, get_covid_data
|
|
except:
|
|
from lib.parse_data import update_data, get_covid_data
|
|
from datetime import datetime
|
|
from asyncio import sleep
|
|
|
|
|
|
async def background_task(client):
|
|
await client.wait_until_ready()
|
|
with open('.keys/report_channel_id') as cid:
|
|
channel = client.get_channel(int(cid.readline().strip()))
|
|
while not client.is_closed():
|
|
current_hour_and_minute = [int(t) for t in str(
|
|
datetime.now().time()).split(':')[:-1]]
|
|
if(current_hour_and_minute[0] == 4 and (current_hour_and_minute[1] == 34)):
|
|
update_data()
|
|
await channel.send('Daily report from: https://www.worldometers.info/coronavirus/')
|
|
await channel.send(get_covid_data('USA'))
|
|
await channel.send(get_covid_data('TOTAL'))
|
|
await sleep(60)
|