stats.py 660 B

123456789101112131415161718192021
  1. from wbb import app, OWNER_ID, bot_start_time
  2. import time
  3. from pyrogram import filters
  4. import psutil
  5. from wbb.utils import cust_filter, formater
  6. __MODULE__ = "Stats"
  7. __HELP__ = "/stats - For Bot Owner To Check System Status [Owner Only]"
  8. @app.on_message(filters.user(OWNER_ID) & cust_filter.command(commands=(["stats"])))
  9. async def stats(client, message):
  10. cpu = psutil.cpu_percent(interval=0.5)
  11. mem = psutil.virtual_memory().percent
  12. disk = psutil.disk_usage("/").percent
  13. stats = (f'''
  14. ```Uptime: {formater.get_readable_time((time.time() - bot_start_time))}
  15. CPU: {cpu}%
  16. RAM: {mem}%
  17. Disk: {disk}%```''')
  18. await message.reply_text(stats)