после /start /addgamer
This commit is contained in:
parent
9e79b97672
commit
974b5ea603
2 changed files with 13 additions and 3 deletions
|
|
@ -92,6 +92,13 @@ class LichessBot:
|
||||||
"(активный игрок меняется в меню команды /getgamers)"
|
"(активный игрок меняется в меню команды /getgamers)"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
async def start_and_addgamer(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||||
|
"""Start command that automatically launches addgamer"""
|
||||||
|
# First run the regular start command
|
||||||
|
await self.start(update, context)
|
||||||
|
# Then start addgamer conversation
|
||||||
|
return await self.addgamer_start(update, context)
|
||||||
|
|
||||||
async def addgamer_start(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
|
async def addgamer_start(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||||
"""Start addgamer command - simple username only"""
|
"""Start addgamer command - simple username only"""
|
||||||
await update.message.reply_text("👤 Введите Lichess username игрока для отслеживания:")
|
await update.message.reply_text("👤 Введите Lichess username игрока для отслеживания:")
|
||||||
|
|
@ -640,7 +647,10 @@ class LichessBot:
|
||||||
|
|
||||||
# Conversation handler for addgamer (simple username only)
|
# Conversation handler for addgamer (simple username only)
|
||||||
addgamer_conv = ConversationHandler(
|
addgamer_conv = ConversationHandler(
|
||||||
entry_points=[CommandHandler("addgamer", self.addgamer_start)],
|
entry_points=[
|
||||||
|
CommandHandler("addgamer", self.addgamer_start),
|
||||||
|
CommandHandler("start", self.start_and_addgamer) # Custom entry point that calls start and addgamer
|
||||||
|
],
|
||||||
states={
|
states={
|
||||||
WAITING_FOR_USERNAME: [MessageHandler(filters.TEXT & ~filters.COMMAND, self.handle_username)],
|
WAITING_FOR_USERNAME: [MessageHandler(filters.TEXT & ~filters.COMMAND, self.handle_username)],
|
||||||
},
|
},
|
||||||
|
|
@ -657,7 +667,7 @@ class LichessBot:
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add all handlers
|
# Add all handlers
|
||||||
application.add_handler(CommandHandler("start", self.start))
|
# Note: start command is handled by addgamer_conv entry_points
|
||||||
application.add_handler(addgamer_conv)
|
application.add_handler(addgamer_conv)
|
||||||
application.add_handler(addtoken_conv)
|
application.add_handler(addtoken_conv)
|
||||||
application.add_handler(CommandHandler("getgamers", self.getgamers))
|
application.add_handler(CommandHandler("getgamers", self.getgamers))
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ LICHESS_STATS_API_BASE_URL = "http://localhost:8001" # For Docker container acc
|
||||||
DATABASE_PATH = "/app/data/lichess_bot.db"
|
DATABASE_PATH = "/app/data/lichess_bot.db"
|
||||||
|
|
||||||
# Period options for /setperiod command
|
# Period options for /setperiod command
|
||||||
PERIOD_OPTIONS = [0, 1, 2, 3, 5, 10, 15, 30, 60, 120, 180] # minutes
|
PERIOD_OPTIONS = [0, 15, 30, 60, 120, 180] # minutes
|
||||||
|
|
||||||
# Telegram Bot Long Polling Configuration
|
# Telegram Bot Long Polling Configuration
|
||||||
POLL_INTERVAL = 1.0 # seconds
|
POLL_INTERVAL = 1.0 # seconds
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue