From 974b5ea603776d74cb763879707ba20947dece01 Mon Sep 17 00:00:00 2001 From: vrubel Date: Wed, 29 Oct 2025 11:32:45 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20/start=20/addg?= =?UTF-8?q?amer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LichessClientTG_bot/bot.py | 14 ++++++++++++-- LichessClientTG_bot/config.py | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/LichessClientTG_bot/bot.py b/LichessClientTG_bot/bot.py index 1efff98..3a5d398 100644 --- a/LichessClientTG_bot/bot.py +++ b/LichessClientTG_bot/bot.py @@ -92,6 +92,13 @@ class LichessBot: "(активный игрок меняется в меню команды /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): """Start addgamer command - simple username only""" await update.message.reply_text("👤 Введите Lichess username игрока для отслеживания:") @@ -640,7 +647,10 @@ class LichessBot: # Conversation handler for addgamer (simple username only) 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={ WAITING_FOR_USERNAME: [MessageHandler(filters.TEXT & ~filters.COMMAND, self.handle_username)], }, @@ -657,7 +667,7 @@ class LichessBot: ) # 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(addtoken_conv) application.add_handler(CommandHandler("getgamers", self.getgamers)) diff --git a/LichessClientTG_bot/config.py b/LichessClientTG_bot/config.py index be95831..7163bcf 100644 --- a/LichessClientTG_bot/config.py +++ b/LichessClientTG_bot/config.py @@ -14,7 +14,7 @@ LICHESS_STATS_API_BASE_URL = "http://localhost:8001" # For Docker container acc DATABASE_PATH = "/app/data/lichess_bot.db" # 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 POLL_INTERVAL = 1.0 # seconds