Fix minor problems with user IDs and datetime
Some checks failed
Build Docker image / test (push) Failing after 2m29s
Build Docker image / build (push) Has been skipped

This commit is contained in:
Roman Krček
2024-10-13 19:06:47 +02:00
parent f941877954
commit c1bf9c1e53
3 changed files with 11 additions and 10 deletions

View File

@@ -1,18 +1,22 @@
import os
from functools import wraps
from telegram_downloader_bot.logger import log
# Comma separated list of Telegram IDs that this bot will respond to
allowed_ids_raw = os.getenv("ALLOWED_IDS", "")
allowed_ids = allowed_ids_raw.split(",")
print(allowed_ids_raw)
print(allowed_ids)
allowed_ids = [int(x) for x in allowed_ids]
def protected(func):
@wraps(func)
async def wrapper(client, message):
if message.from_user.id not in allowed_ids:
if int(message.from_user.id) not in allowed_ids:
log.warning(
f"User with ID {message.from_user.id} attempted to text this bot!")
log.info(
f"Only users allowed are: {' '.join(allowed_ids)}")
return await message.reply_text("You are not on the list!")
return await func(client, message)
return wrapper