Some checks reported errors
continuous-integration/drone/push Build encountered an error
34 lines
990 B
Python
34 lines
990 B
Python
import os
|
|
from dataclasses import dataclass, field
|
|
from typing import List
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
|
|
def get_admin_ids() -> List[int]:
|
|
admin_str = os.getenv("ADMIN_IDS", "")
|
|
if admin_str:
|
|
return [int(x) for x in admin_str.split(",") if x.strip()]
|
|
return []
|
|
|
|
|
|
@dataclass
|
|
class Config:
|
|
bot_token: str = os.getenv("BOT_TOKEN", "")
|
|
admin_ids: List[int] = field(default_factory=get_admin_ids)
|
|
database_path: str = os.getenv("DATABASE_PATH", "data/quiz_bot.db")
|
|
csv_data_path: str = os.getenv("CSV_DATA_PATH", "data/")
|
|
|
|
# Настройки викторины
|
|
questions_per_quiz: int = int(os.getenv("QUESTIONS_PER_QUIZ", "10"))
|
|
time_per_question: int = int(os.getenv("TIME_PER_QUESTION", "30"))
|
|
|
|
# Режимы работы
|
|
guest_mode_enabled: bool = os.getenv("GUEST_MODE_ENABLED", "true").lower() == "true"
|
|
test_mode_enabled: bool = os.getenv("TEST_MODE_ENABLED", "true").lower() == "true"
|
|
|
|
|
|
config = Config()
|