【发布时间】:2020-12-16 15:41:07
【问题描述】:
我有一个问题,当不是管理员的人执行命令“/cls”时,机器人没有发送它应该发送的消息,它所做的就是在 cmd 中给我一个错误。
我添加代码。
@bot.command()
@commands.has_permissions(manage_messages=True)
async def cls(ctx, Quantity= 10000):
if ctx.message.author.guild_permissions.administrator:
await ctx.channel.purge(limit=Quantity)
await ctx.send('Successful removal!' + Quantity + ' mensajes.')
else:
await ctx.send('You cannot run the '/cls' command because you are not admin')
这是当有人执行命令“/cls”时 cmd 告诉我的内容,我想要的是它给出了我放在那里的消息。
discord.ext.commands.errors.MissingPermissions:您缺少运行此命令的“管理消息”权限。
【问题讨论】:
-
顺便说一句,您一次可以批量删除的最大消息是 200 条。所以10k太多了
-
感谢您的回答。
标签: python-3.x discord.py