From 9fe44cf3bfc782df95cf956a49e560b3a015b666 Mon Sep 17 00:00:00 2001 From: liuwei Date: Fri, 21 Feb 2025 17:07:00 +0800 Subject: [PATCH] =?UTF-8?q?debug=20=E6=B8=B8=E6=88=8F=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game_task/game_task_encyclopedia.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/game_task/game_task_encyclopedia.py b/game_task/game_task_encyclopedia.py index 9076c9a..9884546 100644 --- a/game_task/game_task_encyclopedia.py +++ b/game_task/game_task_encyclopedia.py @@ -295,8 +295,13 @@ def game_process_message(group_id, player_id, message, player_name="未知玩家 return show_rank(group_id, player_id) elif message.startswith("/addgroup"): return add_group(group_id, player_id) + elif message == "/gettask": + current_hour = datetime.now().hour + if current_hour >= 23 or current_hour < 9: + return f"当前时间 {current_hour}:00 在23:00-08:00区间,无法领取任务!" + return assign_random_task(group_id) else: - return "无效命令!可用:/start, /tasks, /list, /answer [任务ID] [答案], /addgroup, /rank" + return "无效命令!可用:/start, /tasks, /list, /answer [任务ID] [答案], /addgroup, /gettask, /rank" # 设置定时任务 @@ -321,6 +326,9 @@ if __name__ == "__main__": # 设置调度 setup_schedule() + # 测试 /gettask + print(game_process_message("group1", "player1001", "/gettask")) + while True: schedule.run_pending() - time.sleep(1) + time.sleep(1) \ No newline at end of file