测试插件定时任务
This commit is contained in:
@@ -47,7 +47,7 @@ class GameTaskPlugin(MessagePluginInterface):
|
||||
super().__init__()
|
||||
self.LOG = logger
|
||||
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:
|
||||
"""初始化插件"""
|
||||
@@ -516,9 +516,8 @@ class GameTaskPlugin(MessagePluginInterface):
|
||||
# 获取所有群聊
|
||||
groups = self.encyclopedia_db.get_all_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:
|
||||
continue
|
||||
|
||||
@@ -537,12 +536,12 @@ class GameTaskPlugin(MessagePluginInterface):
|
||||
|
||||
# 创建活跃任务
|
||||
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:
|
||||
await self.bot.send_text_message(
|
||||
group_id,
|
||||
group,
|
||||
f"🎁 新任务来袭,够不够刺激?\n"
|
||||
f"🎀 任务ID: {active_task_id}\n"
|
||||
f"🌟 幸运鹅:{holder_name}\n"
|
||||
|
||||
Reference in New Issue
Block a user