From ad682014560606e63252fc44d9c8b4b6aefc72b4 Mon Sep 17 00:00:00 2001 From: Stijn De Clercq Date: Tue, 13 Oct 2020 21:49:22 +0200 Subject: [PATCH] make stats only show channels in current server --- cogs/stats.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cogs/stats.py b/cogs/stats.py index d0b1b08..0c77cb6 100644 --- a/cogs/stats.py +++ b/cogs/stats.py @@ -102,7 +102,9 @@ class Stats(commands.Cog): embed.set_author(name="Channel Activity - {}".format(ctx.guild)) description = "" - for c in res: + for c in sorted(res, key=lambda x: int(x[1]), reverse=True): + if not any(tc.id == int(c[0]) for tc in ctx.guild.text_channels): + return channel_instance = self.client.get_channel(int(c[0])) description += "{}: {:,}\n".format(channel_instance.mention, round(float(c[1]), 2))