mirror of
https://github.com/Nick80835/microbot
synced 2025-09-01 15:05:48 +00:00
add memory usage to alive
This commit is contained in:
@@ -7,6 +7,7 @@ hachoir
|
|||||||
howdoi
|
howdoi
|
||||||
pillow
|
pillow
|
||||||
praw
|
praw
|
||||||
|
psutil
|
||||||
speedtest-cli
|
speedtest-cli
|
||||||
telethon
|
telethon
|
||||||
Pafy
|
Pafy
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import os
|
||||||
from platform import python_version
|
from platform import python_version
|
||||||
|
|
||||||
|
import psutil
|
||||||
from telethon import version
|
from telethon import version
|
||||||
|
|
||||||
from ubot.micro_bot import ldr, micro_bot
|
from ubot.micro_bot import ldr, micro_bot
|
||||||
@@ -44,9 +46,12 @@ async def sysd(event):
|
|||||||
@ldr.add("alive", sudo=True, hide_help=True)
|
@ldr.add("alive", sudo=True, hide_help=True)
|
||||||
async def alive(event):
|
async def alive(event):
|
||||||
alive_format = "**Telethon version:** {0}\n" \
|
alive_format = "**Telethon version:** {0}\n" \
|
||||||
"**Python version:** {1}"
|
"**Python version:** {1}\n" \
|
||||||
|
"**Memory usage:** {2}MB"
|
||||||
|
|
||||||
await event.reply(alive_format.format(version.__version__, python_version()))
|
mem_usage = int(psutil.Process(os.getpid()).memory_info().rss / 1048576)
|
||||||
|
|
||||||
|
await event.reply(alive_format.format(version.__version__, python_version(), mem_usage))
|
||||||
|
|
||||||
|
|
||||||
@ldr.add("shutdown", owner=True, hide_help=True)
|
@ldr.add("shutdown", owner=True, hide_help=True)
|
||||||
|
Reference in New Issue
Block a user