Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (18.4k points)

I am trying to get the permission of a mentioned discord. Member

I have tried it with

if discord.utils.get(user.guild_permissions, name="manage_messages"):

where the user: discord.Member

and I get this error

Command raised an exception: AttributeError: 'tuple' object has no attribute 'name'

Is there a way to do this?

1 Answer

0 votes
by (36.8k points)
edited by

To check for permissions, you can use the discord. Permissions object's attributes. To check for the manage messages permission, you would do

if <permissions object>.manage_messages:

    #bot's code

In your case, the permissions object would be user.guild_permissions

Do check out Data Science with Python course which helps you understand from scratch 

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...