测试插件定时任务
This commit is contained in:
2
main.py
2
main.py
@@ -108,7 +108,7 @@ def jobs(robot: Robot):
|
|||||||
# await robot.xiu_ren_pdf_send()
|
# await robot.xiu_ren_pdf_send()
|
||||||
|
|
||||||
# ✅ 每 3 小时登录验证
|
# ✅ 每 3 小时登录验证
|
||||||
@async_job.at_times(["14:42"])
|
@async_job.at_times(["14:43"])
|
||||||
async def login_check_job():
|
async def login_check_job():
|
||||||
robot.login_twice_auto_auth()
|
robot.login_twice_auto_auth()
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class GameTaskPlugin(MessagePluginInterface):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self.LOG = logger
|
self.LOG = logger
|
||||||
self.bot: WechatAPIClient = None
|
self.bot: WechatAPIClient = None
|
||||||
async_job.at_times(["14:40"])(self.run_random_task_assignment)
|
async_job.at_times(["14:43"])(self.run_random_task_assignment)
|
||||||
|
|
||||||
def initialize(self, context: Dict[str, Any]) -> bool:
|
def initialize(self, context: Dict[str, Any]) -> bool:
|
||||||
"""初始化插件"""
|
"""初始化插件"""
|
||||||
@@ -516,9 +516,8 @@ class GameTaskPlugin(MessagePluginInterface):
|
|||||||
# 获取所有群聊
|
# 获取所有群聊
|
||||||
groups = self.encyclopedia_db.get_all_groups()
|
groups = self.encyclopedia_db.get_all_groups()
|
||||||
for group in groups:
|
for group in groups:
|
||||||
group_id = group['group_id']
|
|
||||||
# 获取群内所有玩家
|
# 获取群内所有玩家
|
||||||
players = self.encyclopedia_db.get_all_players_in_group(group_id)
|
players = self.encyclopedia_db.get_all_players_in_group(group)
|
||||||
if not players:
|
if not players:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -537,12 +536,12 @@ class GameTaskPlugin(MessagePluginInterface):
|
|||||||
|
|
||||||
# 创建活跃任务
|
# 创建活跃任务
|
||||||
active_task_id = self.encyclopedia_db.create_active_task(
|
active_task_id = self.encyclopedia_db.create_active_task(
|
||||||
group_id, question, answer, score, description, holder_id
|
group, question, answer, score, description, holder_id
|
||||||
)
|
)
|
||||||
|
|
||||||
if active_task_id:
|
if active_task_id:
|
||||||
await self.bot.send_text_message(
|
await self.bot.send_text_message(
|
||||||
group_id,
|
group,
|
||||||
f"🎁 新任务来袭,够不够刺激?\n"
|
f"🎁 新任务来袭,够不够刺激?\n"
|
||||||
f"🎀 任务ID: {active_task_id}\n"
|
f"🎀 任务ID: {active_task_id}\n"
|
||||||
f"🌟 幸运鹅:{holder_name}\n"
|
f"🌟 幸运鹅:{holder_name}\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user