From 8217a57610c0177a130b251af6e408c14b1f822b Mon Sep 17 00:00:00 2001 From: wlinator Date: Mon, 2 Sep 2024 02:49:53 -0400 Subject: [PATCH] refactor: Simplify OWNER_IDS parsing --- lib/const.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/const.py b/lib/const.py index ddbe160..58d5d2f 100644 --- a/lib/const.py +++ b/lib/const.py @@ -36,6 +36,7 @@ class Constants: # bot credentials TOKEN: Final[str | None] = os.environ.get("TOKEN") INSTANCE: Final[str | None] = os.environ.get("INSTANCE") + OWNER_IDS: Final[set[int]] = {int(oid) for oid in os.environ.get("OWNER_IDS", "").split(",") if oid.strip()} XP_GAIN_PER_MESSAGE: Final[int] = int(os.environ.get("XP_GAIN_PER_MESSAGE", 1)) XP_GAIN_COOLDOWN: Final[int] = int(os.environ.get("XP_GAIN_COOLDOWN", 8)) DBX_TOKEN: Final[str | None] = os.environ.get("DBX_OAUTH2_REFRESH_TOKEN") @@ -46,12 +47,6 @@ class Constants: MARIADB_ROOT_PASSWORD: Final[str | None] = os.environ.get("MARIADB_ROOT_PASSWORD") MARIADB_DATABASE: Final[str | None] = os.environ.get("MARIADB_DATABASE") - OWNER_IDS: Final[set[int] | None] = ( - {int(owner_id.strip()) for owner_id in os.environ.get("OWNER_IDS", "").split(",") if owner_id} - if "OWNER_IDS" in os.environ - else None - ) - # metadata TITLE: Final[str] = _s["info"]["title"] AUTHOR: Final[str] = _s["info"]["author"]