init commit

This commit is contained in:
2025-09-11 07:34:50 +09:00
commit 5ddc540f9e
36 changed files with 5103 additions and 0 deletions

1
config/__init__.py Normal file
View File

@@ -0,0 +1 @@
# Config package

29
config/config.py Normal file
View File

@@ -0,0 +1,29 @@
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()