21
Some checks failed
CI / Lint (ruff + mypy) (push) Failing after 32s
CI / Run tests (push) Has been skipped
CI / Docker build test (push) Successful in 14s

This commit is contained in:
2026-04-02 21:32:26 +07:00
parent e7bd488551
commit 8fb6da84ae
4 changed files with 160 additions and 86 deletions

View File

@@ -16,6 +16,8 @@ class BotSettings:
config_path: Path
state_path: Path
admin_ids: set[int]
hidden_link_url: str
hidden_link_char: str
def _parse_admin_ids(value: str) -> set[int]:
@@ -30,20 +32,15 @@ def _parse_admin_ids(value: str) -> set[int]:
def load_settings() -> BotSettings:
load_dotenv()
bot_token = os.environ["BOT_TOKEN"]
channel_id = int(os.environ["CHANNEL_ID"])
channel_message_id = int(os.environ["CHANNEL_MESSAGE_ID"])
config_path = Path(os.environ.get("CONFIG_PATH", "config/actors.json"))
state_path = Path(os.environ.get("STATE_PATH", "data/state.json"))
admin_ids = _parse_admin_ids(os.environ.get("ADMIN_IDS", ""))
return BotSettings(
bot_token=bot_token,
channel_id=channel_id,
channel_message_id=channel_message_id,
config_path=config_path,
state_path=state_path,
admin_ids=admin_ids,
bot_token=os.environ["BOT_TOKEN"],
channel_id=int(os.environ["CHANNEL_ID"]),
channel_message_id=int(os.environ["CHANNEL_MESSAGE_ID"]),
config_path=Path(os.environ.get("CONFIG_PATH", "config/actors.json")),
state_path=Path(os.environ.get("STATE_PATH", "data/state.json")),
admin_ids=_parse_admin_ids(os.environ.get("ADMIN_IDS", "")),
hidden_link_url=os.environ.get("HIDDEN_LINK_URL", ""),
hidden_link_char=os.environ.get("HIDDEN_LINK_CHAR", "​"),
)