Skip to content

Commit

Permalink
Make admin_id a list of admin IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
TheReverend403 committed Mar 19, 2024
1 parent e244bae commit 551a08a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gentoogram/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__}"
)
Expand Down
3 changes: 2 additions & 1 deletion gentoogram/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion gentoogram/resources/config/settings.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[telegram]
token = ""
chat_id = ""
admin_id = ""
admins = []

# https://github.com/python-telegram-bot/python-telegram-bot/wiki/Webhooks
# [webhook]
Expand Down

0 comments on commit 551a08a

Please sign in to comment.