Skip to content

Commit

Permalink
update synced moderation reasons (#60)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
AbstractUmbra and LostLuma authored Nov 1, 2023
1 parent 8a527d9 commit 21c4b2d
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion modules/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,31 @@ async def ban_button(self, interaction: Interaction, button: discord.ui.Button[S
assert interaction.guild
await interaction.response.defer(ephemeral=False)

reason = f"Banned due to grievances in discord.py: {self.target_reason!r}"
reason = f"By {interaction.user} ({interaction.user.id}) due to grievances in discord.py: {self.target_reason!r}"
await interaction.guild.ban(
self.target,
reason=shorten(reason, width=128, placeholder="..."),
)
await interaction.followup.send("Banned.")

self._disable_all_buttons()
await self.message.edit(view=self)

@discord.ui.button(label="Kick", emoji="\U0001f462")
async def kick_button(self, interaction: Interaction, button: discord.ui.Button[Self]) -> None:
assert interaction.guild
await interaction.response.defer(ephemeral=False)

reason = f"By {interaction.user} ({interaction.user.id}) due to grievances in discord.py: {self.target_reason!r}"
await interaction.guild.kick(
self.target,
reason=shorten(reason, width=128, placeholder="..."),
)
await interaction.followup.send("Kicked.")

self._disable_all_buttons()
await self.message.edit(view=self)


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

0 comments on commit 21c4b2d

Please sign in to comment.