/
gurgutan
/
tutor
Обзор
Документация
Войти
/
gurgutan
/
tutor
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/bot/utils.py
31 строка
839 B
Ivan Slepovichev
+llms.py, +async_assistant.py
12 фев 2025, 16:11
12 фев 2025, 16:11
feccf21
Код
Авторство
О чём код?
"""Telegram bot utility functions.""" import os from typing import Dict, Any from pathlib import Path from dotenv import load_dotenv def load_bot_config() -> Dict[str, Any]: """Load bot configuration from environment. Returns: Dictionary with bot configuration """ env_path = Path(".env") if env_path.exists(): load_dotenv(env_path) required_vars = ["BOT_TOKEN", "LLM_NAME", "LLM_API_KEY", "LLM_API_BASE_URL"] missing = [var for var in required_vars if not os.getenv(var)] if missing: raise ValueError( f"Missing required environment variables: {', '.join(missing)}" ) return { "token": os.getenv("BOT_TOKEN"), # "admin_id": int(os.getenv("BOT_ADMIN_ID", 0)), "max_connections": int(os.getenv("BOT_MAX_CONNECTIONS", 10)), }