Python 检查邮件作者是否具有discord.py角色

Python 检查邮件作者是否具有discord.py角色,python,discord,discord.py,Python,Discord,Discord.py,我正在为我的服务器中没有nitro的用户进行“nitro替换”,当有人发送动画表情符号:test:,而他们没有nitro时,机器人会删除消息,然后发送动画表情符号 role = ["-『You're comparing a list (role) to a role object (msg.author.roles). This statement will never be true. You could either get the role, via a getter-funct

我正在为我的服务器中没有nitro的用户进行“nitro替换”,当有人发送动画表情符号
:test:
,而他们没有nitro时,机器人会删除消息,然后发送动画表情符号

role = ["-『You're comparing a list (
role
) to a role object (
msg.author.roles
). This statement will never be true. You could either get the role, via a getter-function, like

role = msg.guild.get_role(id)
role=[“-”“您正在将列表(
role
)与角色对象(
msg.author.roles
)进行比较。此语句永远不会为真。 您可以通过getter函数获得角色,如

或者,与角色名称进行比较


role=“-”如何处理多个角色。如
role=“-”尝试
any(msg.author.roles中[userRoles.name for userRoles]中的角色列表)