From 9395a6c37b9a4a03ca35e9f6ecff3c949aa9ff17 Mon Sep 17 00:00:00 2001 From: "Nyeki.py" <84998222+Nekidev@users.noreply.github.com> Date: Thu, 17 Oct 2024 02:28:02 -0300 Subject: [PATCH] feat(bot): :sparkles: Create `p.stats` command. --- payphone/cogs/mods/cog.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/payphone/cogs/mods/cog.py b/payphone/cogs/mods/cog.py index 4abb18b..73e5750 100644 --- a/payphone/cogs/mods/cog.py +++ b/payphone/cogs/mods/cog.py @@ -295,6 +295,32 @@ class Mods(base.Cog): sys.exit() + @commands.command() + @commands.is_owner() + async def stats(self, ctx: commands.Context) -> None: + """ + Shows all Payphone's stats. + """ + + stats = [ + f"On-call Channels: {await self.bot.redis.scard(constants.CHANNELS_ONCALL_SET)}", + f"Searching Channels: {await self.bot.redis.scard(constants.CHANNELS_ONCALL_SET)}", + f"Messages: {await models.Message.all().count()}", + f"Message Contents: {await models.MessageContent.all().count()}", + f"Calls: {await models.Call.all().count()}", + f"Ongoing Calls: {await models.Call.filter(ended_at=None).count()}", + f"Bans: {await models.Ban.all().count()}", + f"Reports: {await models.Report.all().count()}", + f"On-review Reports: {await models.Report.filter(status=models.ReportStatus.ON_REVIEW).count()}", + f"Users: {await models.User.all().count()}", + f"Profiles: {await models.Profile.all().count()}", + f"Servers: {await models.Server.all().count()}", + f"Shards: {self.bot.shard_count}", + f"Current Shard: {ctx.guild.shard_id + 1}" + ] + + await ctx.send(f"```\n{"\n".join(stats)}\n```") + def setup(b: bot.Payphone) -> None: """Load the cog into the bot.