Currently running the below code to find if the author of a message has a role with a given name:
author = await context.guild.fetch_member(context.author_id)
role = discord.utils.find(lambda r: r.name == 'premium', context.guild.roles)
if role not in author.roles:
some code
It works when there is a single role to the role var.
What I want is to see if the message author doesn't have roles that are given in a list. Like the below example - which doesn't work (it doesn't execute the if
statement even when author has the "verified" role):
author = await context.guild.fetch_member(context.author_id)
role = discord.utils.find(lambda r: r.name in ['premium','verified'], context.guild.roles)
if role not in author.roles:
some code
How can I correctly adjust or replace the lambda function to search if any of the given role names are present in author.roles?