make stats only show channels in current server

pull/1/head
Stijn De Clercq 2020-10-13 21:49:22 +02:00
parent 3226758edf
commit ad68201456
1 changed files with 3 additions and 1 deletions

View File

@ -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))