【发布时间】:2021-02-25 16:08:45
【问题描述】:
我是 python 新手,一般都在创建不和谐的机器人,但我终其一生都无法弄清楚如何让我的机器人根据用户的请求为用户分配角色。
我已经在互联网上搜索了几个小时,并找到了一些示例,但它们都产生了错误。
这是我的命令代码:
@client.command(pass_context=True)
@commands.has_role("Bots")
async def add_bot(ctx):
member = ctx.message.author
role = discord.utils.get(member.server.roles, name="Bots")
await client.add_roles(member, role)
这是我得到的错误:
in _verify_checks raise CheckFailure('The check functions for command {0.qualified_name} failed.'.format(self))
discord.ext.commands.errors.CheckFailure: The check functions for command add_bot failed.
【问题讨论】:
标签: python bots discord.py