Checking if the has a certain role

I’m trying to make a command that can only be used by people with a certain role. Currently I’m using:

if discord.utils.get(, name="Admin").name == "Admin":
    #do stuff here

it works, but if the user doesn’t have that role a

AttributeError: ‘NoneType’ object has no attribute ‘name’

error is thrown. Is there any native function that could be used?

I’m not keen on trying to catch the problem with exceptions

has_roles() no longer seems to exist


The error message is very helpful here. Apparently get sometimes returns None.

role = discord.utils.get(, name="Admin")
if role is not None and == "Admin":
    #do stuff here