Minor change to correct the delayed bg task to CST timezone.
This commit is contained in:
parent
b1c01fc454
commit
62d375de30
2 changed files with 6 additions and 2 deletions
1
Pipfile
1
Pipfile
|
@ -13,6 +13,7 @@ pipfile = "*"
|
||||||
requests = "*"
|
requests = "*"
|
||||||
discord = "*"
|
discord = "*"
|
||||||
beautifulsoup4 = "*"
|
beautifulsoup4 = "*"
|
||||||
|
pytz = "*"
|
||||||
|
|
||||||
[required]
|
[required]
|
||||||
python = "*" # Replace this with your project's stable Python version
|
python = "*" # Replace this with your project's stable Python version
|
||||||
|
|
|
@ -5,6 +5,7 @@ try:
|
||||||
except:
|
except:
|
||||||
from lib.parse_data import update_data, get_covid_data
|
from lib.parse_data import update_data, get_covid_data
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from pytz import timezone
|
||||||
from asyncio import sleep
|
from asyncio import sleep
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,10 +15,12 @@ async def background_task(client):
|
||||||
channel = client.get_channel(int(cid.readline().strip()))
|
channel = client.get_channel(int(cid.readline().strip()))
|
||||||
while not client.is_closed():
|
while not client.is_closed():
|
||||||
current_hour_and_minute = [int(t) for t in str(
|
current_hour_and_minute = [int(t) for t in str(
|
||||||
datetime.now().time()).split(':')[:-1]]
|
datetime.now(timezone('US/Central')).time()).split(':')[:-1]]
|
||||||
if(current_hour_and_minute[0] == 4 and (current_hour_and_minute[1] == 34)):
|
if(current_hour_and_minute[0] == 12 and (current_hour_and_minute[1] == 0)):
|
||||||
update_data()
|
update_data()
|
||||||
await channel.send('Daily report from: https://www.worldometers.info/coronavirus/')
|
await channel.send('Daily report from: https://www.worldometers.info/coronavirus/')
|
||||||
await channel.send(get_covid_data('USA'))
|
await channel.send(get_covid_data('USA'))
|
||||||
await channel.send(get_covid_data('TOTAL'))
|
await channel.send(get_covid_data('TOTAL'))
|
||||||
|
await channel.send(str(
|
||||||
|
datetime.now(timezone('US/Central')).time()).split(':')[:-1])
|
||||||
await sleep(60)
|
await sleep(60)
|
||||||
|
|
Reference in a new issue