优化为异步job,注解完成。
This commit is contained in:
60
main.py
60
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__":
|
||||
|
||||
Reference in New Issue
Block a user