From 2d5696690ef996eb7501907be1e6ea1ef7c7bd85 Mon Sep 17 00:00:00 2001 From: Michael De Roover Date: Fri, 26 Mar 2021 18:08:58 +0100 Subject: [PATCH] Reorder imports and add more .sys stats --- ubot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ubot.py b/ubot.py index 82d3e4e..f252e34 100644 --- a/ubot.py +++ b/ubot.py @@ -1,7 +1,5 @@ import os from telethon import TelegramClient, events -from telethon.tl.custom import Dialog -from telethon.tl.types import Channel, User, Chat # Use your own values from my.telegram.org api_id = os.environ['api_id'] @@ -22,6 +20,8 @@ async def edit(event): await event.edit(msg) if msg.startswith('.stats'): + from telethon.tl.custom import Dialog + from telethon.tl.types import Channel, User, Chat pms = bots = 0 groups = gadmin = gcreator = 0 chans = cadmin = ccreator = 0 @@ -106,12 +106,16 @@ async def edit(event): await event.edit(rpl) if msg.startswith('.sys'): + from telethon import version + from platform import python_version mem = os.popen('free -m').readlines()[1].split()[2] disk = os.popen('df -h /').readlines()[1].split()[2] rpl = f'**System usage stats:**\n' rpl += f'**Memory:** {mem}M\n' rpl += f'**Disk:** {disk}\n' + rpl += f'**Telethon:** {version.__version__}\n' + rpl += f'**Python:** {python_version()}\n' await event.edit(rpl) if msg.startswith('.sauce'):