Skip to content

Commit 21c4b2d

Browse files
update synced moderation reasons (#60)
* update synced moderation reasons * remove duplicate reasons * Update modules/moderation.py Co-authored-by: Lilly Rose Berner <[email protected]> --------- Co-authored-by: Lilly Rose Berner <[email protected]>
1 parent 8a527d9 commit 21c4b2d

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

Diff for: modules/moderation.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -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

106124
class Moderation(commands.Cog):
107125
def __init__(self, bot: core.Bot, /) -> None:

0 commit comments

Comments
 (0)