# config.py import os import logging from dotenv import load_dotenv # Load .env file if exists (for local testing) load_dotenv() logger = logging.getLogger(__name__) class Config: # --- Essential Secrets (Read from Environment/HF Secrets) --- BOT_TOKEN = os.getenv('BOT_TOKEN') API_ID = os.getenv('API_ID') API_HASH = os.getenv('API_HASH') # --- Admin Configuration --- # !!! REPLACE 123456789 WITH YOUR ACTUAL ADMIN TELEGRAM USER ID(S) !!! ADMIN_IDS = [1559968105, 1131003976] # Example: [123456789, 987654321] # --- Validate Secrets --- if not BOT_TOKEN: logger.critical("BOT_TOKEN missing!") raise ValueError("BOT_TOKEN environment variable not set! Add it to Hugging Face Secrets.") if not API_ID: logger.critical("API_ID missing!") raise ValueError("API_ID environment variable not set! Add it to Hugging Face Secrets.") if not API_HASH: logger.critical("API_HASH missing!") raise ValueError("API_HASH environment variable not set! Add it to Hugging Face Secrets.") try: API_ID = int(API_ID) except ValueError: logger.critical("API_ID is not an integer!") raise ValueError("API_ID environment variable must be an integer.") if not ADMIN_IDS or not all(isinstance(admin_id, int) for admin_id in ADMIN_IDS): logger.warning("ADMIN_IDS list is empty or contains non-integer values. Defaulting to empty. Check configuration.") ADMIN_IDS = [] else: logger.info(f"Admin IDs loaded: {ADMIN_IDS}") # --- File Paths & Directories --- PREDEFINED_TEMPLATES_DIR = "templates" # Relative to /app in Docker OUTPUT_DIR = "generated_images" # Relative to /app in Docker FONT_PATH = "Arial" # Relies on system font installed via Dockerfile SESSION_NAME = "bot_hydro_session" # Hydrogram session file name (will be in /app) # --- Image Processing Settings (YOU NEED TO SET THESE ACCURATELY FOR YOUR TEMPLATE) --- TEMPLATE_SIZE = (1200, 900) # The EXACT width and height of your template PNG files. PLACEHOLDER_SIZE = (1200, 600) # The EXACT width and height of the transparent "window" # in your template where the user's image will go. (Example) PLACEHOLDER_POSITION = (0, 0) # The EXACT top-left (x, y) coordinates where the # transparent "window" starts on your template. (Example) # Auto Template Settings (if you use them, otherwise can be ignored) AUTO_TEMPLATES_COUNT = 3 # Reduced for quicker testing; was 5 AUTO_TEMPLATE_SIZE = (1200, 900) AUTO_USER_IMAGE_SIZE = (600, 450) # Text and General Image Settings MIN_FONT_SIZE = 30 MAX_FONT_SIZE = 60 TEXT_STROKE_WIDTH = 2 NOISE_INTENSITY = 0.03 MAX_CAPTION_WIDTH = 35 JPEG_QUALITY = 85 # Example: Text placement for the caption (YOU MUST ADJUST THESE) # These coordinates are relative to the top-left (0,0) of your TEMPLATE_SIZE canvas. TEXT_AREA_Y_START = 700 # Example: Y-coordinate where your text background bar begins TEXT_AREA_HEIGHT = 150 # Example: Height of your text background bar # Horizontal centering for text is often done dynamically in processing.py