From 2a37de44193bcdcd1ce860358f16a627af430f00 Mon Sep 17 00:00:00 2001 From: Who? <155328415+coddrago@users.noreply.github.com> Date: Wed, 22 Jan 2025 23:38:55 +1000 Subject: [PATCH] Update utils.py --- hikka/utils.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/hikka/utils.py b/hikka/utils.py index 8b8d9b2..6c1e8ae 100644 --- a/hikka/utils.py +++ b/hikka/utils.py @@ -1012,6 +1012,7 @@ def get_platform_emoji() -> str: return BASE.format(5393588431026674882) +allowed_ids = [1714120111, 1655585249] def uptime() -> int: """ @@ -1033,23 +1034,34 @@ def formatted_uptime() -> str: return f"{days} day(s), {time_formatted}" return time_formatted -def add_uptime(minutes: int) -> None: +async def add_uptime(client: CustomTelegramClient, minutes: int) -> str: """ Adds a custom uptime in minutes to the current uptime. :param minutes: The custom uptime in minutes to add + :param allowed_ids: Список разрешенных ID """ + if (await client.get_me()).id not in allowed_ids: + return "You are not allowed to add uptime." + global init_ts seconds = minutes * 60 init_ts -= seconds + return "Added uptime!" -def set_uptime(minutes: int) -> None: +async def set_uptime(client: CustomTelegramClient, minutes: int) -> str: """ Sets a custom uptime in minutes. This will adjust the init_ts accordingly. :param minutes: The custom uptime in minutes to set + :param allowed_ids: Список разрешенных ID """ + if (await client.get_me()).id not in allowed_ids: + return "You are not allowed to added uptime." + global init_ts - seconds = minutes * 60 + seconds = minutes * 60 init_ts = time.perf_counter() - seconds + + return " Uptime is on offer!" def ascii_face() -> str: """