【发布时间】:2018-12-17 18:31:01
【问题描述】:
我试图让我的机器人通过吐出You do not have the permissions {} 来告诉用户是否有错误但是当我尝试使用此代码时:
@client.command(pass_context = True)
async def ban(ctx, member : discord.Member, *, content: str):
if ctx.message.author == client.user:
return
if ctx.message.author.server_permissions.administrator:
msg = (str(member) + "has been banned for" + str(content)).format(ctx.message)
await client.send_message(member, content)
await client.ban(member)
await client.send_message(ctx.message.channel, msg)
@ban.error
async def ban_error(error, ctx):
if isinstance(error, CheckFailure):
msg = "Sorry but you do not have the permissions {}".format(ctx.message.author.mention)
await client.send_message(ctx.message.channel, msg)
discord bot dms 用户,python 控制台中没有错误,如果我删除 @ban.error 部分,我会得到一个权限错误太低。
【问题讨论】:
-
而且它甚至没有禁止人并且该成员已被禁止因为内容没有出现在服务器聊天中
标签: python python-3.x discord discord.py