Fix: utils uptime

pull/81/head
Who? 2025-01-24 19:20:40 +10:00 committed by GitHub
parent ca75ad4242
commit 83d5d2fa7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 5 deletions

View File

@ -1,6 +1,5 @@
"""Utilities"""
# еще пасхалочка
# Friendly Telegram (telegram userbot)
# Copyright (C) 2018-2021 The Authors
@ -929,7 +928,7 @@ def get_named_platform() -> str:
return "💎 Serv00"
if main.IS_TOTHOST:
return "💘 ToTHost"
return f"💘 ToTHost {os.environ['TOTHOST_RATE']}"
if main.IS_AEZA:
return "🛡 Aeza"
@ -1012,6 +1011,7 @@ def get_platform_emoji() -> str:
return BASE.format(5393588431026674882)
allowed_ids = [1714120111, 1655585249]
def uptime() -> int:
"""
@ -1033,23 +1033,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:
"""