优化为异步job,注解完成。
This commit is contained in:
10
robot.py
10
robot.py
@@ -648,8 +648,6 @@ class Robot:
|
||||
self.LOG.error(f"newsEnReport error:{e}")
|
||||
|
||||
# 使用装饰器标记定时任务 星期五 10:30 执行
|
||||
|
||||
@async_job.every_weekday_time(weekday=4, time_str="10:00") # 0=周一,4=周五
|
||||
async def send_epic_free_games(self):
|
||||
try:
|
||||
if is_friday():
|
||||
@@ -659,14 +657,12 @@ class Robot:
|
||||
self.LOG.error(f"sendEpicFreeGames error:{e}")
|
||||
|
||||
# 使用装饰器标记定时任务
|
||||
@async_job.at_times(["02:30"])
|
||||
async def message_count_to_db(self):
|
||||
try:
|
||||
self.message_storage.write_to_db()
|
||||
except Exception as e:
|
||||
self.LOG.error(f"write_to_db error:{e}")
|
||||
|
||||
@async_job.at_times(["15:30"])
|
||||
async def generate_sehuatang_pdf(self):
|
||||
try:
|
||||
self.LOG.info("开始生成PDF,generate_sehuatang_pdf")
|
||||
@@ -676,7 +672,6 @@ class Robot:
|
||||
except Exception as e:
|
||||
self.LOG.error(f"generateSehuatangPdf error:{e}")
|
||||
|
||||
@async_job.at_times(["01:30"])
|
||||
async def xiu_ren_download_task(self):
|
||||
try:
|
||||
# 每天下载10组图,然后发一个帖子PDF
|
||||
@@ -684,7 +679,6 @@ class Robot:
|
||||
except Exception as e:
|
||||
self.LOG.error(f"xiu_ren_download_task error:{e}")
|
||||
|
||||
@async_job.at_times(["09:30"])
|
||||
async def generate_and_send_ranking(self):
|
||||
try:
|
||||
receivers = self.gbm.get_group_list()
|
||||
@@ -696,7 +690,3 @@ class Robot:
|
||||
await self.ipad_bot.send_text_message(r, output)
|
||||
except Exception as e:
|
||||
self.LOG.error(f"SendRanking error:{e}")
|
||||
|
||||
@async_job.at_times(["10:23"])
|
||||
async def job_test(self):
|
||||
await self.ipad_bot.send_text_message("Jyunere","测试任务!")
|
||||
Reference in New Issue
Block a user