Compare commits
2 commits
d580331b31
...
008d4b8d57
Author | SHA1 | Date | |
---|---|---|---|
008d4b8d57 | |||
45a5354299 |
1 changed files with 6 additions and 1 deletions
|
@ -300,7 +300,7 @@ class Moderation(commands.Cog):
|
||||||
async def ban(self, interaction: discord.Interaction, target: discord.User, reason: str, duration: str = None, delete_messages: Choice[int] = 0):
|
async def ban(self, interaction: discord.Interaction, target: discord.User, reason: str, duration: str = None, delete_messages: Choice[int] = 0):
|
||||||
"""Ban a user."""
|
"""Ban a user."""
|
||||||
try:
|
try:
|
||||||
await interaction.guild.fetch_ban(target.id)
|
await interaction.guild.fetch_ban(target)
|
||||||
await interaction.response.send_message(content=f"{target.mention} is already banned!", ephemeral=True)
|
await interaction.response.send_message(content=f"{target.mention} is already banned!", ephemeral=True)
|
||||||
return
|
return
|
||||||
except discord.errors.NotFound:
|
except discord.errors.NotFound:
|
||||||
|
@ -332,6 +332,11 @@ class Moderation(commands.Cog):
|
||||||
@app_commands.command(name="unban")
|
@app_commands.command(name="unban")
|
||||||
async def unban(self, interaction: discord.Interaction, target: discord.User, reason: str = None):
|
async def unban(self, interaction: discord.Interaction, target: discord.User, reason: str = None):
|
||||||
"""Unban a user."""
|
"""Unban a user."""
|
||||||
|
try:
|
||||||
|
await interaction.guild.fetch_ban(target)
|
||||||
|
except discord.errors.NotFound:
|
||||||
|
await interaction.response.send_message(content=f"{target.mention} is not banned!", ephemeral=True)
|
||||||
|
return
|
||||||
if reason:
|
if reason:
|
||||||
await interaction.guild.unban(target.id, reason=f"Unbanned by {interaction.user.id} for: {reason}")
|
await interaction.guild.unban(target.id, reason=f"Unbanned by {interaction.user.id} for: {reason}")
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue