diff --git a/main.py b/main.py index 3b02850..e30e7eb 100644 --- a/main.py +++ b/main.py @@ -71,35 +71,45 @@ def main(): def jobs(robot: Robot): - # # 每天 8:30 发送新闻 + # ✅ 每天 8:30 发送百度新闻 @async_job.at_times(["08:30"]) async def news_baidu_report_auto_job(): await robot.news_baidu_report_auto() - @async_job.at_times(["10:36"]) - async def test_job(): - logger.info("测试jobs") - await robot.job_test() - # # - # # # epic - # robot.onEveryTime("10:30", robot.send_epic_free_games) - # # - # # # message report 1:数据自动从redis 转到sqllite - # robot.onEveryTime("02:30", robot.message_count_to_db) - # # # 从db中提取并发送给相关群 - # robot.onEveryTime("09:30", robot.generate_and_send_ranking) - # # - # # # sehuatang - # robot.onEveryTime("15:30", robot.generate_sehuatang_pdf) - # # - # # # 秀人网每天自动下载帖子 - # robot.onEveryTime("01:30", robot.xiu_ren_download_task) - # # - # # # 秀人网每天自动发pdf - # # robot.onEveryTime("17:30", robot.xiu_ren_pdf_send) - # - # # 每天进行二次登录检查 - # robot.onEveryHours(3, robot.login_twice_auto_auth) + # ✅ 每天 10:30 推送 Epic 免费游戏 + @async_job.every_weekday_time(weekday=4, time_str="10:00") # 0=周一,4=周五 + async def epic_job(): + await robot.send_epic_free_games() + + # ✅ 每天 02:30 从 redis 写入 sqlite + @async_job.at_times(["02:30"]) + async def msg_count_to_db_job(): + await robot.message_count_to_db() + + # ✅ 每天 09:30 从 sqlite 读取并发送群排行 + @async_job.at_times(["09:30"]) + async def msg_ranking_job(): + await robot.generate_and_send_ranking() + + # ✅ 每天 15:30 发涩图 PDF + @async_job.at_times(["15:30"]) + async def sehuatang_pdf_job(): + await robot.generate_sehuatang_pdf() + + # ✅ 每天 01:30 下载秀人网帖子 + @async_job.at_times(["01:30"]) + async def xiuren_download_job(): + await robot.xiu_ren_download_task() + + # ✅ 每天 17:30 发秀人 PDF(如果启用) + # @async_job.at_times(["17:30"]) + # async def xiuren_pdf_send_job(): + # await robot.xiu_ren_pdf_send() + + # ✅ 每 3 小时登录验证 + @async_job.every_hours(3) + async def login_check_job(): + robot.login_twice_auto_auth() if __name__ == "__main__": diff --git a/robot.py b/robot.py index e5dc31c..8454968 100644 --- a/robot.py +++ b/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","测试任务!") \ No newline at end of file