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匹马) -/赛马报名 - 复用上一次绑定的马名报名 +/赛马报名 - 复用上次绑定的马名,若无则使用群昵称 /赛马取消报名 - 取消报名并退还下注 /赛马下注 <序号|马匹名> <金额> - 下注 /赛马赔率 - 查看当前赔率和下注池