diff options
Diffstat (limited to 'code/cogs/owner/stats.py')
-rw-r--r-- | code/cogs/owner/stats.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/code/cogs/owner/stats.py b/code/cogs/owner/stats.py index 3ca31a2..d81ec13 100644 --- a/code/cogs/owner/stats.py +++ b/code/cogs/owner/stats.py @@ -56,16 +56,24 @@ class Stats(commands.Cog): connection = sqlite3.connect("count.db") cursor = connection.cursor() - embed = discord.Embed(title="Command Statistics", color=BOT_COLOR) + # Pull the top 5 commands being run + data = cursor.execute( + "SELECT * FROM count ORDER BY count DESC LIMIT 5" + ).fetchall() + + # Get the combined total amount of commands run + total_commands = cursor.execute("SELECT SUM(count) FROM count").fetchone()[0] + + embed = discord.Embed( + title="Statistics", + description=f"Total Guilds: `{len(self.bot.guilds):,}`\nTotal Commands: `{total_commands:,}`\n\nTotal Players: `{self.bot.lavalink.nodes[0].stats.playing_players}`\nLoad: `{round(self.bot.lavalink.nodes[0].stats.lavalink_load * 100, 2)}%`", + color=BOT_COLOR, + ) - total = 0 - data = cursor.execute("SELECT * FROM count").fetchall() for entry in data: - embed.add_field(name=entry[0], value=f"` {entry[1]} `", inline=True) - total += entry[1] - - embed.add_field(name="TOTAL", value=f"` {total} `", inline=False) + embed.add_field(name=entry[0], value=f"` {entry[1]:,} `", inline=True) + connection.close() await ctx.send(embed=embed) |