Python 如果某人具有特定权限/角色,则使其免于亵渎过滤器discord.py

Python 如果某人具有特定权限/角色,则使其免于亵渎过滤器discord.py,python,discord.py,Python,Discord.py,所以我为我的discord机器人做了一个亵渎过滤器,它工作得非常完美。我希望它不会影响具有特定角色或权限的人。我知道如何使用decorator@commands.has_role(“name”)和@commands.has_权限([ban_members=True,kick_members=True]),但我不知道如何在我的bot中实现这一点。这是密码 @commands.Cog.listener() async def on_message(self, message): if n

所以我为我的discord机器人做了一个亵渎过滤器,它工作得非常完美。我希望它不会影响具有特定角色或权限的人。我知道如何使用decorator@commands.has_role(“name”)和@commands.has_权限([ban_members=True,kick_members=True]),但我不知道如何在我的bot中实现这一点。这是密码

@commands.Cog.listener()
  async def on_message(self, message):
    if not message.author.bot:
      if profanity.contains_profanity(message.content):
        await message.delete()
        await message.channel.send("You can't say that here")
任何帮助都将不胜感激。
谢谢

如果邮件具有以下属性,则可以检查您在邮件作者角色中的角色:

if not message.author.bot:
  if message.guild:
    if your_role in message.author.roles:
      return