From d0c2cfc6b862443393e97715b9a2e6e43536e5a8 Mon Sep 17 00:00:00 2001 From: huker667 Date: Tue, 4 Aug 2026 22:06:18 +0300 Subject: доб проверку на макс промпты в ap и sp калбеке MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'commands.py') diff --git a/commands.py b/commands.py index beecfd1..d50f605 100644 --- a/commands.py +++ b/commands.py @@ -331,15 +331,23 @@ async def start_handler(message: Message, command: CommandObject): ) ) elif prompt_pub: - return await message.reply( - f"✅ вот `{prompt.get('name', 'говно')}` промпт крутой da:" - f"```\n{prompt.get('text')}\n```", - reply_markup=InlineKeyboardMarkup( + if len(config["prompts"]) => MAX_PROMPTS: + keyboard = InlineKeyboardMarkup( + inline_keyboard=[ + [InlineKeyboardButton(text="достигнут лимит промптов", callback_data=f"hamza")], + ] + ) + else: + InlineKeyboardMarkup( inline_keyboard=[ [InlineKeyboardButton(text="✅ добавить", callback_data=f"ap%{user_id}%{prompt_user_id}%{prompt_id}")], [InlineKeyboardButton(text="✅🔗 доб. + установить", callback_data=f"sp%{user_id}%{prompt_user_id}%{prompt_id}%2")], ] ) + return await message.reply( + f"✅ вот `{prompt.get('name', 'говно')}` промпт крутой da:" + f"```\n{prompt.get('text')}\n```", + reply_markup=keyboard ) except Exception as e: print(f"{YELLOW} -- prompt - {e}{RESET}") -- cgit v1.3.1