forked from sass/tipibot
Update env variables
This commit is contained in:
@@ -44,7 +44,7 @@ BASE_ROLE_IDS: list[int] = [1478304631930228779, 1478302278862766190]
|
||||
|
||||
|
||||
def _parse_admin_roles(raw: str) -> dict[int, set[int]]:
|
||||
"""Parse BOT_ADMIN_ROLES env var as "guild_id:role_id[:role_id...],guild_id:role_id...".
|
||||
"""Parse DISCORD_ADMIN_ROLES env var as "guild_id:role_id[:role_id...],guild_id:role_id...".
|
||||
|
||||
Multiple admin roles per guild are colon-separated; guild entries are comma-separated.
|
||||
Repeating a guild_id across entries merges its roles.
|
||||
@@ -57,14 +57,14 @@ def _parse_admin_roles(raw: str) -> dict[int, set[int]]:
|
||||
parts = entry.split(":")
|
||||
if len(parts) < 2 or not all(p.strip() for p in parts):
|
||||
raise SystemExit(
|
||||
f"BOT_ADMIN_ROLES: expected 'guild_id:role_id[:role_id...]', got {entry!r}"
|
||||
f"DISCORD_ADMIN_ROLES: expected 'guild_id:role_id[:role_id...]', got {entry!r}"
|
||||
)
|
||||
guild_id = int(parts[0].strip())
|
||||
result.setdefault(guild_id, set()).update(int(p.strip()) for p in parts[1:])
|
||||
return result
|
||||
|
||||
|
||||
BOT_ADMIN_ROLES: dict[int, set[int]] = _parse_admin_roles(os.getenv("BOT_ADMIN_ROLES", ""))
|
||||
BOT_ADMIN_ROLES: dict[int, set[int]] = _parse_admin_roles(os.getenv("DISCORD_ADMIN_ROLES", ""))
|
||||
|
||||
PB_URL = os.getenv("PB_URL", "http://127.0.0.1:8090")
|
||||
PB_ADMIN_EMAIL = os.getenv("PB_ADMIN_EMAIL", "")
|
||||
|
||||
Reference in New Issue
Block a user