@@ -57,6 +57,7 @@ async def high_score_command(self: Self, interaction: discord.Interaction) -> No
5757 Args:
5858 interaction (discord.Interaction): The interaction that started this command
5959 """
60+ await interaction .response .defer ()
6061 all_bans = await self .bot .models .BanLog .query .where (
6162 self .bot .models .BanLog .guild_id == str (interaction .guild .id )
6263 ).gino .all ()
@@ -68,19 +69,22 @@ async def high_score_command(self: Self, interaction: discord.Interaction) -> No
6869 embed = discord .Embed (title = "Most active moderators" )
6970
7071 final_string = ""
71- for index , (moderator_id , count ) in enumerate (sorted_ban_frequency ):
72- moderator = await interaction .guild .fetch_member (int (moderator_id ))
72+ for index , (moderator_id , count ) in enumerate (sorted_ban_frequency [:10 ]):
73+ try :
74+ moderator = await interaction .guild .fetch_member (int (moderator_id ))
75+ except discord .NotFound :
76+ moderator = None
7377 if moderator :
7478 final_string += (
7579 f"{ index + 1 } . { moderator .display_name } "
76- f"{ moderator .mention } ({ moderator .id } ) - ( { count } ) \n "
80+ f"{ moderator .mention } ({ moderator .id } ) - { count } \n "
7781 )
7882 else :
79- final_string += { f"{ index + 1 } . Moderator left: { moderator_id } " }
83+ final_string += f"{ index + 1 } . Moderator left: { moderator_id } - { count } \n "
8084
8185 embed .description = final_string
8286 embed .color = discord .Color .blue ()
83- await interaction .response . send_message (embed = embed )
87+ await interaction .followup . send (embed = embed )
8488
8589 @modlog_group .command (
8690 name = "lookup-user" ,
0 commit comments