@@ -95,13 +95,31 @@ async def ban_button(self, interaction: Interaction, button: discord.ui.Button[S
9595 assert interaction .guild
9696 await interaction .response .defer (ephemeral = False )
9797
98- reason = f"Banned due to grievances in discord.py: { self .target_reason !r} "
98+ reason = f"By { interaction . user } ( { interaction . user . id } ) due to grievances in discord.py: { self .target_reason !r} "
9999 await interaction .guild .ban (
100100 self .target ,
101101 reason = shorten (reason , width = 128 , placeholder = "..." ),
102102 )
103103 await interaction .followup .send ("Banned." )
104104
105+ self ._disable_all_buttons ()
106+ await self .message .edit (view = self )
107+
108+ @discord .ui .button (label = "Kick" , emoji = "\U0001f462 " )
109+ async def kick_button (self , interaction : Interaction , button : discord .ui .Button [Self ]) -> None :
110+ assert interaction .guild
111+ await interaction .response .defer (ephemeral = False )
112+
113+ reason = f"By { interaction .user } ({ interaction .user .id } ) due to grievances in discord.py: { self .target_reason !r} "
114+ await interaction .guild .kick (
115+ self .target ,
116+ reason = shorten (reason , width = 128 , placeholder = "..." ),
117+ )
118+ await interaction .followup .send ("Kicked." )
119+
120+ self ._disable_all_buttons ()
121+ await self .message .edit (view = self )
122+
105123
106124class Moderation (commands .Cog ):
107125 def __init__ (self , bot : core .Bot , / ) -> None :
0 commit comments