def censor(self, ctx, times: int=1):
"""Delete the bot's previous message(s). Bot owner only.
* times - Number of message to delete. Defaults to 1.
"""
if times < 1:
return commands.UserInputError("Can't delete less than 1 message.")
times_executed = 0
async for message in ctx.channel.history():
if times_executed == times:
break
if message.author.id == ctx.bot.user.id:
await message.delete()
times_executed += 1
评论列表
文章目录