47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
|
|
import discord
|
||
|
|
from datetime import timedelta
|
||
|
|
import time
|
||
|
|
import psutil
|
||
|
|
import os
|
||
|
|
|
||
|
|
async def execute(bot, params, message):
|
||
|
|
embed = discord.Embed(
|
||
|
|
title="Statut du Superviseur",
|
||
|
|
color=discord.Color.green()
|
||
|
|
)
|
||
|
|
|
||
|
|
# Bot info
|
||
|
|
embed.add_field(
|
||
|
|
name="🤖 Bot",
|
||
|
|
value=f"Connecté en tant que {bot.user.mention}\n"
|
||
|
|
f"Serveur principal : {bot.guild_id}\n"
|
||
|
|
f"Latence : {round(bot.latency * 1000)}ms",
|
||
|
|
inline=True
|
||
|
|
)
|
||
|
|
|
||
|
|
# AI/Memory stats
|
||
|
|
metrics = bot.get_metrics()
|
||
|
|
embed.add_field(
|
||
|
|
name="🧠 IA & Mémoire",
|
||
|
|
value=f"Requêtes LLM : {metrics.get('total_llm_requests', 0)}\n"
|
||
|
|
f"Succès : {metrics.get('total_llm_success', 0)}\n"
|
||
|
|
f"Erreurs : {metrics.get('total_llm_errors', 0)}\n"
|
||
|
|
f"Temps moyen : {round(metrics.get('total_llm_time', 0) / max(metrics.get('total_llm_requests', 1), 1), 2)}s",
|
||
|
|
inline=True
|
||
|
|
)
|
||
|
|
|
||
|
|
# System stats
|
||
|
|
process = psutil.Process(os.getpid())
|
||
|
|
memory = process.memory_info().rss / 1024 / 1024 # MB
|
||
|
|
uptime = timedelta(seconds=time.time() - process.create_time())
|
||
|
|
embed.add_field(
|
||
|
|
name="💻 Système",
|
||
|
|
value=f"Mémoire : {round(memory, 2)} MB\n"
|
||
|
|
f"Disponible : {round(psutil.virtual_memory().available / 1024 / 1024, 0)} MB\n"
|
||
|
|
f"Disponible pour bot : {round(psutil.virtual_memory().available / 1024 / 1024 / 1024, 2)} GB",
|
||
|
|
inline=True
|
||
|
|
)
|
||
|
|
|
||
|
|
embed.set_footer(text=f"Uptime: {uptime}")
|
||
|
|
await message.channel.send(embed=embed)
|