每小时发放一个任务。
This commit is contained in:
@@ -469,7 +469,7 @@ def game_process_message(group_id, player_id, message, player_name="未知玩家
|
||||
def setup_schedule():
|
||||
group_ids = get_group_ids()
|
||||
for gid in group_ids:
|
||||
schedule.every().hour.at(":00").do(run_random_task_assignment, group_id=gid)
|
||||
run_random_task_assignment(group_id=gid)
|
||||
|
||||
|
||||
# 主程序
|
||||
|
||||
5
main.py
5
main.py
@@ -10,6 +10,7 @@ from game_task.game_task_encyclopedia import setup_schedule
|
||||
from robot import Robot, __version__
|
||||
from wcferry import Wcf
|
||||
|
||||
|
||||
def main(chat_type: int):
|
||||
config = Config()
|
||||
wcf = Wcf(debug=True)
|
||||
@@ -44,8 +45,8 @@ def main(chat_type: int):
|
||||
# sehuatang
|
||||
robot.onEveryTime("15:00", robot.generateSehuatangPdf)
|
||||
|
||||
# 游戏的定时任务一直执行
|
||||
setup_schedule()
|
||||
# 游戏的定时任务每小时执行
|
||||
robot.onEveryHours("1", robot.game_auto_tasks)
|
||||
# 让机器人一直跑
|
||||
robot.keepRunningAndBlockProcess()
|
||||
|
||||
|
||||
9
robot.py
9
robot.py
@@ -24,7 +24,7 @@ from base.func_xinghuo_web import XinghuoWeb
|
||||
from base.func_claude import Claude
|
||||
from configuration import Config
|
||||
from constants import ChatType
|
||||
from game_task.game_task_encyclopedia import game_process_message
|
||||
from game_task.game_task_encyclopedia import game_process_message, setup_schedule
|
||||
from group_auto.group_auto_invite import get_first_group_id, process_command
|
||||
from group_auto.group_member_change import GroupMemberChange
|
||||
from robot_cmd.robot_command import GroupBotManager
|
||||
@@ -503,3 +503,10 @@ class Robot(Job):
|
||||
self.sendTextMsg("群发言总结功能未开启", sender)
|
||||
except Exception as e:
|
||||
self.LOG.error(f"message_summary_robot error:{e}")
|
||||
|
||||
# 设置定时任务
|
||||
def game_auto_tasks(self):
|
||||
try:
|
||||
setup_schedule()
|
||||
except Exception as e:
|
||||
self.LOG.error(f"message_summary_robot error:{e}")
|
||||
|
||||
Reference in New Issue
Block a user