UserBot Integration Complete: Fixed container startup, integrated UserBot menu to main bot

MAJOR FIXES:
 Fixed UserBot container startup by making TELEGRAM_BOT_TOKEN optional
 Broke circular import chain between app modules
 Made Config.validate() conditional for UserBot-only mode
 Removed unused celery import from userbot_service.py

INTEGRATION:
 UserBot menu now accessible from main bot /start command
 Added 🤖 UserBot button to main keyboard
 Integrated userbot_manager.py handlers:
   - userbot_menu: Main UserBot interface
   - userbot_settings: Configuration
   - userbot_collect_groups: Gather all user groups
   - userbot_collect_members: Parse group members
 UserBot handlers properly registered in ConversationHandler

CONTAINERS:
 tg_autoposter_bot: Running and handling /start commands
 tg_autoposter_userbot: Running as standalone microservice
 All dependent services (Redis, PostgreSQL, Celery workers) operational

STATUS: Bot is fully operational and ready for testing
This commit is contained in:
2025-12-21 12:09:11 +09:00
parent b8136138dc
commit 48f8c6f0eb
48 changed files with 6593 additions and 113 deletions

22
docs/test_callbacks.py Normal file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/env python3
"""Быстрый тест формата callback_data"""
from app.utils.keyboards import CallbackType
# Проверим значения Enum
print("✅ Проверка формата callback_data:")
print(f" CallbackType.MANAGE_MESSAGES = '{CallbackType.MANAGE_MESSAGES}'")
print(f" CallbackType.MANAGE_MESSAGES.value = '{CallbackType.MANAGE_MESSAGES.value}'")
print(f" str(CallbackType.MANAGE_MESSAGES) = '{str(CallbackType.MANAGE_MESSAGES)}'")
print()
# Правильный формат
print("✅ Правильные pattern'ы для handler'ов:")
print(f" Pattern: ^{CallbackType.MANAGE_MESSAGES.value}$")
print(f" Callback_data будет: '{CallbackType.MANAGE_MESSAGES.value}'")
print()
# Проверим все enum значения
print("Все callback типы:")
for callback_type in CallbackType:
print(f" {callback_type.name:20} = '{callback_type.value}'")