diff --git a/gentoogram/__main__.py b/gentoogram/__main__.py index 75e1146..97267dd 100644 --- a/gentoogram/__main__.py +++ b/gentoogram/__main__.py @@ -54,7 +54,7 @@ async def wrapped( update: Update, context: ContextTypes.DEFAULT_TYPE, *args, **kwargs ): user = update.effective_user - if user.id != config.get("telegram.admin_id"): + if user.id not in config.get("telegram.admins"): logger.info( f"{user.full_name} ({user.id}) was denied access to {func.__name__}" ) diff --git a/gentoogram/config.py b/gentoogram/config.py index ac6b8b2..77c24e2 100644 --- a/gentoogram/config.py +++ b/gentoogram/config.py @@ -39,7 +39,8 @@ len_min=1, is_type_of=str, ), - Validator("telegram.chat_id", "telegram.admin_id", must_exist=True, is_type_of=int), + Validator("telegram.chat_id", must_exist=True, is_type_of=int), + Validator("telegram.admins", must_exist=True, is_type_of=list), Validator( "webhook.enabled", is_type_of=bool, diff --git a/gentoogram/resources/config/settings.toml b/gentoogram/resources/config/settings.toml index 81c2170..202a2c8 100644 --- a/gentoogram/resources/config/settings.toml +++ b/gentoogram/resources/config/settings.toml @@ -1,7 +1,7 @@ [telegram] token = "" chat_id = "" -admin_id = "" +admins = [] # https://github.com/python-telegram-bot/python-telegram-bot/wiki/Webhooks # [webhook]