Skip to content

Commit

Permalink
sorted warnings by timestamp descending
Browse files Browse the repository at this point in the history
  • Loading branch information
99oblivius committed Sep 19, 2024
1 parent 2e62687 commit 50b1e43
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cogs/moderation/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ async def moderation_infractions(self, interaction: nextcord.Interaction,

all_warnings = await self.bot.store.get_user_warnings(guild_id=interaction.guild.id, user_id=user.id, warn_filters=warn_filters)
grouped_users = defaultdict(list)
for warn in all_warnings:
grouped_users[warn.type].append(warn)
for warning in sorted(all_warnings, key=lambda x: x.timestamp, reverse=True):
grouped_users[warning.type].append(warning)

embed = nextcord.Embed(
title=f"User Infractions Summary{f' by {','.join((w.value.capitalize() for w in warn_filters))}' if warn_filters else ''}",
Expand Down

0 comments on commit 50b1e43

Please sign in to comment.