forked from Aadhi000/OP-Rename-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.py
More file actions
40 lines (35 loc) · 1.26 KB
/
Copy pathadmin.py
File metadata and controls
40 lines (35 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# (c) @Aadhi000
import shutil
import psutil
from pyrogram import filters
from pyrogram.types import (
Message
)
from configs import Config
from bot.client import Client
from bot.core.db.database import db
from bot.core.display import humanbytes
from bot.core.handlers.broadcast import broadcast_handler
@Client.on_message(filters.command("status") & filters.user(Config.OWNER_ID))
async def status_handler(_, m: Message):
total, used, free = shutil.disk_usage(".")
total = humanbytes(total)
used = humanbytes(used)
free = humanbytes(free)
cpu_usage = psutil.cpu_percent()
ram_usage = psutil.virtual_memory().percent
disk_usage = psutil.disk_usage('/').percent
total_users = await db.total_users_count()
await m.reply_text(
text=f"**Total Disk Space:** {total} \n"
f"**Used Space:** {used}({disk_usage}%) \n"
f"**Free Space:** {free} \n"
f"**CPU Usage:** {cpu_usage}% \n"
f"**RAM Usage:** {ram_usage}%\n\n"
f"**Total Users in DB:** `{total_users}`",
parse_mode="Markdown",
quote=True
)
@Client.on_message(filters.command("broadcast") & filters.user(Config.OWNER_ID) & filters.reply)
async def broadcast_in(_, m: Message):
await broadcast_handler(m)