discord-dota-bot/utils.py
Ching 7bf56375c6 feat(bot.py, utils.py): 修改了消息的格式,更改发送任务循环时间
修改了消息的格式,更改发送任务循环时间

Signed-off-by: Ching <loooching@gmail.com>
2023-09-16 13:03:31 +08:00

18 lines
541 B
Python

import datetime
import requests
def convert_seconds_to_hms(total_seconds):
hours, remainder = divmod(total_seconds, 3600)
minutes, seconds = divmod(remainder, 60)
return hours, minutes, seconds
def is_workday():
return datetime.datetime.today().weekday() < 5
def is_game_time():
# game time is workday 21:00 - 1:00, weekend 10:00 - 1:00
if is_workday():
return datetime.datetime.now().hour >= 21 or datetime.datetime.now().hour < 1
else:
return datetime.datetime.now().hour >= 10 or datetime.datetime.now().hour < 1