2025-09-14 18:54:56 -04:00
|
|
|
import discord
|
|
|
|
|
from discord import app_commands
|
|
|
|
|
from discord.ext import commands
|
|
|
|
|
from discord.ext.commands import Context
|
|
|
|
|
|
|
|
|
|
|
2025-09-28 23:07:46 -04:00
|
|
|
def purge_command():
|
2025-09-14 18:54:56 -04:00
|
|
|
@commands.hybrid_command(
|
|
|
|
|
name="purge",
|
|
|
|
|
description="Delete a number of messages.",
|
|
|
|
|
)
|
|
|
|
|
@commands.has_guild_permissions(manage_messages=True)
|
|
|
|
|
@commands.bot_has_permissions(manage_messages=True)
|
|
|
|
|
@app_commands.describe(amount="The amount of messages that should be deleted.")
|
2025-09-28 23:07:46 -04:00
|
|
|
async def purge(self, context, amount: int):
|
2025-09-14 18:54:56 -04:00
|
|
|
await context.send("Deleting messages...")
|
|
|
|
|
purged_messages = await context.channel.purge(limit=amount + 1)
|
|
|
|
|
embed = discord.Embed(
|
2025-09-16 06:57:12 -04:00
|
|
|
title="Purge",
|
2025-09-14 18:54:56 -04:00
|
|
|
description=f"**{context.author}** cleared **{len(purged_messages)-1}** messages!",
|
2025-09-16 06:57:12 -04:00
|
|
|
color=0x7289DA,
|
2025-09-14 18:54:56 -04:00
|
|
|
)
|
2025-09-28 13:19:28 -04:00
|
|
|
embed.set_author(name="Moderation", icon_url="https://yes.nighty.works/raw/CPKHQd.png")
|
2025-09-14 18:54:56 -04:00
|
|
|
await context.channel.send(embed=embed)
|
2025-09-28 23:07:46 -04:00
|
|
|
|
|
|
|
|
return purge
|