forked from sass/tipibot
Change admin command permissions
This commit is contained in:
17
config.py
17
config.py
@@ -42,6 +42,23 @@ BIRTHDAY_CHANNEL_ID = (
|
||||
BIRTHDAY_WINDOW_DAYS = int(os.getenv("BIRTHDAY_WINDOW_DAYS", "7"))
|
||||
BASE_ROLE_IDS: list[int] = [1478304631930228779, 1478302278862766190]
|
||||
|
||||
|
||||
def _parse_admin_roles(raw: str) -> dict[int, int]:
|
||||
"""Parse BOT_ADMIN_ROLES env var as "guild_id:role_id,guild_id:role_id"."""
|
||||
result: dict[int, int] = {}
|
||||
for pair in raw.split(","):
|
||||
pair = pair.strip()
|
||||
if not pair:
|
||||
continue
|
||||
guild_str, _, role_str = pair.partition(":")
|
||||
if not role_str:
|
||||
raise SystemExit(f"BOT_ADMIN_ROLES: expected 'guild_id:role_id', got {pair!r}")
|
||||
result[int(guild_str)] = int(role_str)
|
||||
return result
|
||||
|
||||
|
||||
BOT_ADMIN_ROLES: dict[int, int] = _parse_admin_roles(os.getenv("BOT_ADMIN_ROLES", ""))
|
||||
|
||||
PB_URL = os.getenv("PB_URL", "http://127.0.0.1:8090")
|
||||
PB_ADMIN_EMAIL = os.getenv("PB_ADMIN_EMAIL", "")
|
||||
PB_ADMIN_PASSWORD = os.getenv("PB_ADMIN_PASSWORD", "")
|
||||
|
||||
Reference in New Issue
Block a user