【发布时间】:2019-07-31 19:17:01
【问题描述】:
我正在为我的不和谐制作一个临时静音命令,但我不知道我应该使用什么命令,没有给出错误。这是一个意想不到的结果,如果你能告诉我如何添加一个理由,那就太好了!.命令如下。
@bot.command(pass_context=True, name="tempmute")
@has_permissions(mute_members=True)
async def tempmute(ctx, *, target: Member):
if target.server_permissions.administrator:
await bot.say("Target is an admin")
else:
try:
await bot.mute(target)
await bot.say('{} got muted by {}'.format(target.mention, message.author))
except Exception:
await bot.say("Something went wrong")
@tempmute.error
async def tempmute_error(error, ctx):
if isinstance(error, CheckFailure):
await bot.send_message(ctx.message.channel, "You do not have permissions")
elif isinstance(error, BadArgument):
await bot.send_message(ctx.message.channel, "Could not identify target")
else:
raise error
但是该命令既不会使目标静音也不会暂时使目标静音,也不会发送任何错误,它只是说“出了点问题”。我也找不到一个命令,我可以在其中让调用该命令的成员排队等待 bot.say('{} 被 {}'.format(target.mention, message.author)) 静音message.author 我应该写什么来让调用命令的成员静音目标
【问题讨论】:
标签: python bots discord.py