Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update synced moderation reasons #60

Merged
merged 3 commits into from
Nov 1, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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("Banned.")
AbstractUmbra marked this conversation as resolved.
Show resolved Hide resolved

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


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