feat(telegram_bot): Add simplified team registration format with output options
- Add support for simplified team_reg callback format (team_reg:1, team_reg:3, team_reg:5) - Implement direct count parsing from callback data without intermediate steps - Add output method selection UI with JSON file and team.json options - Add custom count input handler for flexible registration quantities (1-50) - Improve user experience by reducing callback navigation steps - Set user state flag for awaiting custom count input
This commit is contained in:
@@ -3342,6 +3342,43 @@ class ProvisionerBot:
|
|||||||
action = data[1] if len(data) > 1 else ""
|
action = data[1] if len(data) > 1 else ""
|
||||||
value = data[2] if len(data) > 2 else ""
|
value = data[2] if len(data) > 2 else ""
|
||||||
|
|
||||||
|
# 处理简化格式: team_reg:1, team_reg:3, team_reg:5, team_reg:custom
|
||||||
|
if action.isdigit():
|
||||||
|
# team_reg:1 -> 直接是数量
|
||||||
|
count = int(action)
|
||||||
|
# 显示输出方式选择
|
||||||
|
keyboard = [
|
||||||
|
[
|
||||||
|
InlineKeyboardButton("📄 JSON 文件", callback_data=f"team_reg:output:json:{count}"),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
InlineKeyboardButton("📥 添加到 team.json", callback_data=f"team_reg:output:team:{count}"),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
reply_markup = InlineKeyboardMarkup(keyboard)
|
||||||
|
|
||||||
|
await query.edit_message_text(
|
||||||
|
f"<b>⚙️ 配置完成</b>\n\n"
|
||||||
|
f"注册数量: {count} 个\n\n"
|
||||||
|
f"请选择输出方式:",
|
||||||
|
parse_mode="HTML",
|
||||||
|
reply_markup=reply_markup
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
|
if action == "custom":
|
||||||
|
# team_reg:custom -> 自定义数量
|
||||||
|
await query.edit_message_text(
|
||||||
|
"<b>📝 自定义数量</b>\n\n"
|
||||||
|
"请发送数量 (1-50):\n"
|
||||||
|
"直接回复一个数字即可\n\n"
|
||||||
|
"例如: <code>20</code>",
|
||||||
|
parse_mode="HTML"
|
||||||
|
)
|
||||||
|
# 设置等待输入状态
|
||||||
|
context.user_data["team_waiting_count"] = True
|
||||||
|
return
|
||||||
|
|
||||||
if action == "count":
|
if action == "count":
|
||||||
if value == "custom":
|
if value == "custom":
|
||||||
await query.edit_message_text(
|
await query.edit_message_text(
|
||||||
|
|||||||
Reference in New Issue
Block a user