重构机器人
This commit is contained in:
57
bot/handlers/start.py
Normal file
57
bot/handlers/start.py
Normal file
@@ -0,0 +1,57 @@
|
||||
"""
|
||||
/start 和 /help 命令处理器
|
||||
"""
|
||||
|
||||
from telegram import Update
|
||||
from telegram.ext import ContextTypes
|
||||
|
||||
from bot.middlewares.auth import require_auth
|
||||
|
||||
|
||||
@require_auth
|
||||
async def start_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
"""
|
||||
处理 /start 命令 - 欢迎信息
|
||||
"""
|
||||
user = update.effective_user
|
||||
welcome_text = f"""
|
||||
👋 你好, {user.first_name}!
|
||||
|
||||
🔗 **支付链接生成器**
|
||||
|
||||
📋 命令:
|
||||
• `/go [数量] [plan]` - 生成支付链接
|
||||
• `/status [task_id]` - 查看任务状态
|
||||
• `/set workers <数量>` - 设置并发数
|
||||
|
||||
💡 使用 /help 查看详细帮助
|
||||
"""
|
||||
await update.message.reply_text(welcome_text, parse_mode="Markdown")
|
||||
|
||||
|
||||
@require_auth
|
||||
async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
"""
|
||||
处理 /help 命令 - 详细帮助信息
|
||||
"""
|
||||
help_text = """
|
||||
📖 **命令说明**
|
||||
|
||||
**生成支付链接**
|
||||
`/go` - 生成 1 个 Plus 支付链接
|
||||
`/go 5` - 生成 5 个 Plus 支付链接
|
||||
`/go 3 pro` - 生成 3 个 Pro 支付链接
|
||||
|
||||
可选 plan: `plus` (默认) 或 `pro`
|
||||
|
||||
**查看任务状态**
|
||||
`/status` - 查看所有任务
|
||||
`/status <task_id>` - 查看指定任务
|
||||
|
||||
**设置**
|
||||
`/set` - 查看当前设置
|
||||
`/set workers 3` - 设置并发数 (1-5)
|
||||
|
||||
📎 结果将以 JSON 文件形式发送
|
||||
"""
|
||||
await update.message.reply_text(help_text, parse_mode="Markdown")
|
||||
Reference in New Issue
Block a user