Update for coockies use
This commit is contained in:
25
main.py
25
main.py
@@ -38,6 +38,31 @@ async def run_bot():
|
||||
"""Run Telegram bot"""
|
||||
logger.info("Starting Telegram bot...")
|
||||
|
||||
# Check cookies file if configured
|
||||
from shared.config import settings
|
||||
if settings.COOKIES_FILE:
|
||||
from pathlib import Path
|
||||
import os
|
||||
cookies_paths = [
|
||||
Path(settings.COOKIES_FILE),
|
||||
Path(__file__).parent / settings.COOKIES_FILE,
|
||||
Path(os.getcwd()) / settings.COOKIES_FILE,
|
||||
]
|
||||
cookies_found = False
|
||||
for path in cookies_paths:
|
||||
if path.exists() and path.is_file():
|
||||
logger.info(f"✅ Cookies file found: {path} (configured as: {settings.COOKIES_FILE})")
|
||||
cookies_found = True
|
||||
break
|
||||
if not cookies_found:
|
||||
logger.warning(
|
||||
f"⚠️ Cookies file not found: {settings.COOKIES_FILE}. "
|
||||
f"Searched in: {[str(p) for p in cookies_paths]}. "
|
||||
f"Instagram downloads may fail without cookies."
|
||||
)
|
||||
else:
|
||||
logger.info("ℹ️ No cookies file configured (COOKIES_FILE not set)")
|
||||
|
||||
# Initialize database
|
||||
await init_db()
|
||||
logger.info("Database initialized")
|
||||
|
||||
Reference in New Issue
Block a user