feat(bot): ✨ Create p.stats command.

This commit is contained in:
Nyeki.py
2024-10-17 02:28:02 -03:00
parent 2c9db71c60
commit 9395a6c37b
+26
View File
@@ -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.