我如何获得缺少的许可? (api的“ missing_perms”)
elif isinstance(error, commands.MissingPermissions):
await ctx.message.delete()
error = discord.Embed(
title = 'Error',
description = 'Missing permission!',
colour = discord.Colour.red()
)
error.set_footer(text=version)
textMsg = await ctx.send(embed=error)
await textMsg.delete(delay=4)
类似“ manage_guild”的
答案 0 :(得分:1)
MissingPermissions
对象具有属性missing_perms
,该属性是缺少的权限的列表:
elif isinstance(error, commands.MissingPermissions):
await ctx.message.delete()
embed= discord.Embed(
title = 'Error',
description = f'Missing permissions: {error.missing_perms}',
colour = discord.Colour.red()
)
embed.set_footer(text=version)
textMsg = await ctx.send(embed=embed)
await textMsg.delete(delay=4)