20 lines
664 B
Python
20 lines
664 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 settings.allowed_ids_list:
|
|
log.warning(
|
|
f"User with ID {message.from_user.id} attempted"
|
|
"to text this bot!")
|
|
log.info(
|
|
"Only users allowed are:"
|
|
f"{' '.join(settings.allowed_ids_list)}")
|
|
return await message.reply_text("You are not on the list!")
|
|
return await func(client, message)
|
|
return wrapper
|