From b4f71ddb3bb6348e3864fec968913befebf1dcde Mon Sep 17 00:00:00 2001 From: "Mr.Xia" <1424473282@qq.com> Date: Tue, 7 Apr 2026 20:50:28 +0800 Subject: [PATCH] =?UTF-8?q?docs(=E8=B5=9B=E9=A9=AC=E6=8F=92=E4=BB=B6):=20?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=91=BD=E4=BB=A4=E8=AF=B4=E6=98=8E=E5=B9=B6?= =?UTF-8?q?=E6=94=B9=E8=BF=9B=E9=BB=98=E8=AE=A4=E9=A9=AC=E5=90=8D=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在README中补充命令参数和示例 - 当未提供马名时,自动使用用户昵称作为默认马名 - 优化帮助文本中的命令描述 --- danding_bot/plugins/group_horse_racing/README.md | 4 +++- danding_bot/plugins/group_horse_racing/commands.py | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/danding_bot/plugins/group_horse_racing/README.md b/danding_bot/plugins/group_horse_racing/README.md index 5834fbb..47df75a 100644 --- a/danding_bot/plugins/group_horse_racing/README.md +++ b/danding_bot/plugins/group_horse_racing/README.md @@ -19,7 +19,9 @@ | 命令 | 说明 | 示例 | |------|------|------| -| `/赛马报名` | 报名参加赛马比赛 | `/赛马报名` | +| `/赛马报名 <马匹名>` | 报名参加赛马比赛。若不输入则复用上次马名或使用昵称 | `/赛马报名 绝地赤兔` | +| `/赛马取消报名` | 取消报名并退还下注(限开始前) | `/赛马取消报名` | +| `/赛马下注 <序号|马名> <金额>` | 为马匹下注 | `/赛马下注 01 100` | | `/赛马开赛` | 开始比赛(需要至少2匹马) | `/赛马开赛` | | `/赛马帮助` | 显示帮助信息 | `/赛马帮助` | diff --git a/danding_bot/plugins/group_horse_racing/commands.py b/danding_bot/plugins/group_horse_racing/commands.py index 724920a..30adfdd 100644 --- a/danding_bot/plugins/group_horse_racing/commands.py +++ b/danding_bot/plugins/group_horse_racing/commands.py @@ -351,8 +351,11 @@ async def handle_register(bot: Bot, event: Event): horse_name = parts[1].strip() if len(parts) > 1 else room_store.get_last_horse_name(user_id) or "" if not horse_name: - await register_cmd.finish("请输入马匹名:/赛马报名 <马匹名>。若你之前报过名,也可以直接发送 /赛马报名 复用上一次绑定的马名") - return + scope = get_scope(event) + horse_name = await _get_user_name(bot, scope, user_id) + # Ensure name is not too long when using nickname as default + if len(horse_name) > 10: + horse_name = horse_name[:10] if len(horse_name) > 10: await register_cmd.finish("马匹名不能超过10个字符") @@ -570,7 +573,7 @@ async def handle_help(bot: Bot, event: Event): 📌 命令列表: /赛马报名 <马匹名> - 报名参赛(最多8匹马) -/赛马报名 - 复用上一次绑定的马名报名 +/赛马报名 - 复用上次绑定的马名,若无则使用群昵称 /赛马取消报名 - 取消报名并退还下注 /赛马下注 <序号|马匹名> <金额> - 下注 /赛马赔率 - 查看当前赔率和下注池