Files
Telegram-Downloader-Bot/telegram_downloader_bot/security.py
2024-10-13 21:05:51 +02:00

19 lines
618 B
Python

from functools import wraps
from telegram_downloader_bot.logger import log
from telegram_downloader_bot.settings import settings
def protected(func):
@wraps(func)
async def wrapper(client, message):
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