Reorder imports and add more .sys stats
This commit is contained in:
parent
472dacb9bd
commit
2d5696690e
8
ubot.py
8
ubot.py
@ -1,7 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
from telethon import TelegramClient, events
|
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
|
# Use your own values from my.telegram.org
|
||||||
api_id = os.environ['api_id']
|
api_id = os.environ['api_id']
|
||||||
@ -22,6 +20,8 @@ async def edit(event):
|
|||||||
await event.edit(msg)
|
await event.edit(msg)
|
||||||
|
|
||||||
if msg.startswith('.stats'):
|
if msg.startswith('.stats'):
|
||||||
|
from telethon.tl.custom import Dialog
|
||||||
|
from telethon.tl.types import Channel, User, Chat
|
||||||
pms = bots = 0
|
pms = bots = 0
|
||||||
groups = gadmin = gcreator = 0
|
groups = gadmin = gcreator = 0
|
||||||
chans = cadmin = ccreator = 0
|
chans = cadmin = ccreator = 0
|
||||||
@ -106,12 +106,16 @@ async def edit(event):
|
|||||||
await event.edit(rpl)
|
await event.edit(rpl)
|
||||||
|
|
||||||
if msg.startswith('.sys'):
|
if msg.startswith('.sys'):
|
||||||
|
from telethon import version
|
||||||
|
from platform import python_version
|
||||||
mem = os.popen('free -m').readlines()[1].split()[2]
|
mem = os.popen('free -m').readlines()[1].split()[2]
|
||||||
disk = os.popen('df -h /').readlines()[1].split()[2]
|
disk = os.popen('df -h /').readlines()[1].split()[2]
|
||||||
|
|
||||||
rpl = f'**System usage stats:**\n'
|
rpl = f'**System usage stats:**\n'
|
||||||
rpl += f'**Memory:** {mem}M\n'
|
rpl += f'**Memory:** {mem}M\n'
|
||||||
rpl += f'**Disk:** {disk}\n'
|
rpl += f'**Disk:** {disk}\n'
|
||||||
|
rpl += f'**Telethon:** {version.__version__}\n'
|
||||||
|
rpl += f'**Python:** {python_version()}\n'
|
||||||
await event.edit(rpl)
|
await event.edit(rpl)
|
||||||
|
|
||||||
if msg.startswith('.sauce'):
|
if msg.startswith('.sauce'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user