@@ -95,13 +95,31 @@ async def ban_button(self, interaction: Interaction, button: discord.ui.Button[S
95
95
assert interaction .guild
96
96
await interaction .response .defer (ephemeral = False )
97
97
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} "
99
99
await interaction .guild .ban (
100
100
self .target ,
101
101
reason = shorten (reason , width = 128 , placeholder = "..." ),
102
102
)
103
103
await interaction .followup .send ("Banned." )
104
104
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
+
105
123
106
124
class Moderation (commands .Cog ):
107
125
def __init__ (self , bot : core .Bot , / ) -> None :
0 commit comments