✅ 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:
@@ -20,7 +20,8 @@ class Config:
|
||||
TELEGRAM_BOT_TOKEN = os.getenv('TELEGRAM_BOT_TOKEN', '')
|
||||
TELEGRAM_TIMEOUT = int(os.getenv('TELEGRAM_TIMEOUT', '30'))
|
||||
|
||||
if not TELEGRAM_BOT_TOKEN:
|
||||
# Не требовать BOT_TOKEN если запущены в режиме UserBot микросервиса
|
||||
if not TELEGRAM_BOT_TOKEN and not os.getenv('TELETHON_API_ID'):
|
||||
raise ValueError(
|
||||
"❌ TELEGRAM_BOT_TOKEN не установлен в .env\n"
|
||||
"Получите токен у @BotFather в Telegram"
|
||||
@@ -130,7 +131,12 @@ class Config:
|
||||
@classmethod
|
||||
def validate(cls) -> bool:
|
||||
"""Проверить конфигурацию"""
|
||||
# Основное - токен бота
|
||||
# Если есть TELETHON_API_ID - это UserBot микросервис, BOT_TOKEN не требуется
|
||||
if cls.TELETHON_API_ID:
|
||||
# Проверить конфиг Telethon
|
||||
return bool(cls.TELETHON_API_ID and cls.TELETHON_API_HASH and cls.TELETHON_PHONE)
|
||||
|
||||
# Для основного бота - требуется токен
|
||||
if not cls.TELEGRAM_BOT_TOKEN:
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user