我见过其他机器人在ban()中使用= reason参数,但它对我不起作用。我希望有理由出现在Discord的服务器日志中(在禁令列表中)而不是我的。示例代码:
@client.command(pass_context=True)
async def ban(ctx, member: discord.Member, banreason: str):
await client.ban(member, delete_message_days=7, reason=banreason)
client.ban
在使用最新版本的reason
时没有discord.py
参数,请参阅文档:http://discordpy.readthedocs.io/en/latest/api.html#discord.Client.ban
但是,重写分支确实包含reason
参数。 http://discordpy.readthedocs.io/en/rewrite/api.html#discord.Guild.ban