MCPcopy Create free account
hub / github.com/TechifyBots/Rename-Bot / get_status

Function get_status

plugins/web_support.py:16–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14os.makedirs('templates', exist_ok=True)
15
16async def get_status():
17 # Calculate your bot status metrics
18 total_users = await digital_botz.total_users_count()
19 if Config.PREMIUM_MODE:
20 total_premium_users = await digital_botz.total_premium_users_count()
21 else:
22 total_premium_users = "Disabled ✅"
23 currentTime = time.strftime("%Hh%Mm%Ss", time.gmtime(time.time() - Config.BOT_UPTIME))
24 total, used, free = shutil.disk_usage(".")
25 total = humanbytes(total)
26 used = humanbytes(used)
27 free = humanbytes(free)
28 sent = humanbytes(psutil.net_io_counters().bytes_sent)
29 recv = humanbytes(psutil.net_io_counters().bytes_recv)
30 cpu_usage = psutil.cpu_percent()
31 ram_usage = psutil.virtual_memory().percent
32 disk_usage = psutil.disk_usage('/').percent
33 return {
34 "status": "Operational",
35 "version": __version__,
36 "total_users": total_users,
37 "total_premium_users": total_premium_users,
38 "uptime": currentTime,
39 "cpu_usage": cpu_usage,
40 "ram_usage": ram_usage,
41 "disk_usage": disk_usage,
42 "total_disk": total,
43 "used_disk": used,
44 "free_disk": free,
45 "sent": sent,
46 "recv": recv
47 }
48TechifyBots = web.RouteTableDef()
49
50@TechifyBots.get("/", allow_head=True)

Callers 1

root_route_handlerFunction · 0.85

Calls 3

humanbytesFunction · 0.90
total_users_countMethod · 0.80

Tested by

no test coverage detected