Update utils.py

pull/78/head
Who? 2025-01-22 23:38:55 +10:00 committed by GitHub
parent aa19fd2994
commit 2a37de4419
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 3 deletions

View File

@ -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:
"""