Fixed wlinfo

This commit is contained in:
2021-11-06 21:36:24 +01:00
parent 6658c96615
commit bc94157a0c
+12 -15
View File
@@ -58,29 +58,26 @@ class InformationCog(commands.Cog, name="Information"):
async def wlinfo(self, ctx: Context): async def wlinfo(self, ctx: Context):
"""Retrieve various Node/Server/Player information.""" """Retrieve various Node/Server/Player information."""
player = self.bot.lavalink.player_manager.get(ctx.guild.id) player = self.bot.lavalink.player_manager.get(ctx.guild.id)
node = player.node nodes = self.bot.lavalink.node_manager.available_nodes
used = humanize.naturalsize(node.stats.memory_used) used = humanize.naturalsize(sum([n.stats.memory_used for n in nodes]))
total = humanize.naturalsize(node.stats.memory_allocated) total = humanize.naturalsize(sum([n.stats.memory_allocated for n in nodes]))
free = humanize.naturalsize(node.stats.memory_free) free = humanize.naturalsize(sum([n.stats.memory_free for n in nodes]))
cpu = node.stats.cpu_cores cpu = sum([n.stats.cpu_cores for n in nodes])
fmt = ( fmt = (
f"**WaveLink:** `{lavalink.__version__}`\n\n" f"**Lavalink:** `{lavalink.__version__}`\n\n"
f"Connected to `{len(self.bot.lavalink.nodes)}` nodes.\n" f"Connected to `{len(self.bot.lavalink.node_manager.available_nodes)}` nodes.\n"
f"Best available Node `{self.bot.lavalink.get_best_node().__repr__()}`\n" f"Best available Node `{self.bot.lavalink.node_manager.find_ideal_node().identifier.__repr__()}`\n"
f"`{len(self.bot.lavalink.players)}` players are distributed on nodes.\n" f"`{len(self.bot.lavalink.player_manager.players)}` players are distributed on nodes.\n"
f"`{node.stats.players}` players are distributed on server.\n" f"`{sum([n.stats.players for n in nodes])}` players are distributed on server.\n"
f"`{node.stats.playing_players}` players are playing on server.\n\n" f"`{sum([n.stats.playing_players for n in nodes])}` players are playing on server.\n\n"
f"Server Memory: `{used}/{total}` | `({free} free)`\n" f"Server Memory: `{used}/{total}` | `({free} free)`\n"
f"Server CPU: `{cpu}`\n\n" f"Server CPU: `{cpu}`\n\n"
f"Server Uptime: `{datetime.timedelta(milliseconds=node.stats.uptime)}`" #f"Server Uptime: `{datetime.timedelta(milliseconds=node.stats.uptime)}`"
) )
await ctx.send(fmt) await ctx.send(fmt)
from utils import database
database.AutoJoin.get_channels()
@commands.command(name="help", aliases=["about", "info"], slash_command=True) @commands.command(name="help", aliases=["about", "info"], slash_command=True)
@commands.cooldown(1, 1, commands.BucketType.user) @commands.cooldown(1, 1, commands.BucketType.user)
async def about( async def about(