Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -149,6 +149,19 @@ async def on_member_join(member):
|
|
| 149 |
|
| 150 |
await channel.send(embed=embed)
|
| 151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
@bot.event
|
| 153 |
async def on_command_error(ctx, error):
|
| 154 |
if isinstance(error, commands.CommandNotFound):
|
|
|
|
| 149 |
|
| 150 |
await channel.send(embed=embed)
|
| 151 |
|
| 152 |
+
@bot.command()
|
| 153 |
+
@commands.has_permissions(manage_messages=True)
|
| 154 |
+
async def purge(ctx, limit: int):
|
| 155 |
+
"""Removes N amount of messages."""
|
| 156 |
+
try:
|
| 157 |
+
await ctx.channel.purge(limit=limit + 1) # Add 1 to include the command message itself
|
| 158 |
+
await ctx.send(f"{limit} messages have been purged.")
|
| 159 |
+
except discord.Forbidden:
|
| 160 |
+
await ctx.send("I don't have permission to manage messages.")
|
| 161 |
+
except discord.HTTPException:
|
| 162 |
+
await ctx.send("An error occurred while trying to purge messages. Please try again later.")
|
| 163 |
+
|
| 164 |
+
|
| 165 |
@bot.event
|
| 166 |
async def on_command_error(ctx, error):
|
| 167 |
if isinstance(error, commands.CommandNotFound):
|