#!/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 pytz import timezone 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(timezone('US/Central')).time()).split(':')[:-1]] if(current_hour_and_minute[0] == 12 and (current_hour_and_minute[1] == 0)): 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)