错误模块是 BotMissionPermissions。我在处理它时犯了一个错误,但它没有发送它。我已经删除了我的机器人 ban_members
的权限。主要问题是,它没有不和谐地发送错误消息。它应该像I don't have permission to perform this command
一样发送不和谐。如果你明白请帮忙!
@client.command()
@commands.has_permissions(ban_members=True)
@commands.bot_has_permissions(ban_members=True)
async def ban(ctx, member: discord.Member=None, *, reason=None):
if not member:
await ctx.send("**Please specify a `user`.**")
return
if reason==None:
return await ctx.send("**Please include a** **`valid reason`.**")
if member == ctx.message.author:
return await ctx.send("**You cannot ban** **`yourself`**.")
await member.ban(reason=None)
await ctx.channel.send(f"****Banned**** **`{member}`** **for the following reason :** **`{reason}` **")
await member.send(f"you have been banned from: {ctx.guild.name}")
@ban.error
async def banerror(ctx, error):
if isinstance(error, commands.errors.CommandInvokeError):
await ctx.send("**I don't have the permsission `ban members`.**")
@ban.error
async def banerrogr(ctx, error):
if isinstance(error, commands.BotMissingPermissions):
await ctx.send("**I don't have the permission `ban members`.**")
@ban.error
async def ban_error(ctx, error):
if isinstance(error, commands.MissingPermissions):
embed=discord.Embed(color=0xff8800)
embed.add_field(name="Access denied", value="You do not have permission to ban members :no_entry:", inline=True)
await ctx.send(embed=embed)
答案 0 :(得分:0)
也许这个程序适合你
<servlet>
<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>my.package.ApiAuthorizationFilterImpl;</param-value>
</init-param>
</servlet>