1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| import discord
from discord.ext import commands
from discord.ext.commands import Bot, has_permissions, CheckFailure
bot = commands.Bot(command_prefix = "*", description = "Juste un BOT")
@bot.command(pass_context=True, help="Supprime le nombre de messages")
@has_permissions(administrator=True)
async def clear(ctx, messageDeleted : int):
messages = await ctx.channel.history(limit = messageDeleted + 1).flatten()
for message in messages:
await message.delete()
message = messageDeleted, "messages ont été supprimés"
embed = discord.Embed(title = (message), color=0x1f8b4c)
await ctx.send(embed = embed, delete_after=3)
@clear.error
async def clear_error(ctx, error):
if isinstance(error, CheckFailure):
msg = "Oups, on dirait que tu n'as pas la permission d'executer cette commande {}".format(ctx.message.author.mention)
await ctx.send(msg) |
Partager