diff --git a/danding_bot/plugins/group_horse_racing/test_commands.py b/danding_bot/plugins/group_horse_racing/test_commands.py index eb296c7..ad01bcd 100644 --- a/danding_bot/plugins/group_horse_racing/test_commands.py +++ b/danding_bot/plugins/group_horse_racing/test_commands.py @@ -43,7 +43,29 @@ async def handle_test_set_points(bot: Bot, event: Event): await test_set_points_cmd.finish("权限不足") return - await test_set_points_cmd.finish("请使用: /测试设置积分 <金额>") + # Get the message text and extract amount + msg = str(event.get_message()).strip() + # Remove command prefix + parts = msg.split() + + if len(parts) < 2: + await test_set_points_cmd.finish("请使用: /测试设置积分 <金额>") + return + + try: + amount = int(parts[1]) + if amount < 0: + await test_set_points_cmd.finish("金额必须为非负数") + return + except ValueError: + await test_set_points_cmd.finish("金额必须是整数") + return + + success, _ = await points_service.set_points(event.user_id, amount, f"测试设置积分为{amount}") + if success: + await test_set_points_cmd.finish(f"积分已设置为 {amount}") + else: + await test_set_points_cmd.finish("设置失败") test_query_points_cmd = on_command("测试查询积分", priority=5)