diff --git a/Pipfile b/Pipfile index a0f52bd..ababc56 100644 --- a/Pipfile +++ b/Pipfile @@ -13,6 +13,7 @@ pipfile = "*" requests = "*" discord = "*" beautifulsoup4 = "*" +pytz = "*" [required] python = "*" # Replace this with your project's stable Python version diff --git a/lib/covid_report_lib.py b/lib/covid_report_lib.py index 9665660..3ac310c 100644 --- a/lib/covid_report_lib.py +++ b/lib/covid_report_lib.py @@ -5,6 +5,7 @@ try: except: from lib.parse_data import update_data, get_covid_data from datetime import datetime +from pytz import timezone from asyncio import sleep @@ -14,10 +15,12 @@ async def background_task(client): 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)): + 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 channel.send(str( + datetime.now(timezone('US/Central')).time()).split(':')[:-1]) await sleep(60)