N
N
Nolrox2022-01-09 22:22:53
Python
Nolrox, 2022-01-09 22:22:53

How to make the bot give the highest role?

I need to make the bot get a list of all roles on the server and give the user the highest role. How can this be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lord Legitov, 2022-01-10
@lordcodes

Get the Guild object in any way
Get the list of roles in hierarchical order and give the user the highest role.

author = message.author # получаем автора сообщения
guild = self.get_guild(id) #id получаешь программно или вписываешь статический если бот только на 1 сервере
role = guild.roles[0] # получаем высшую роль
await author.add_roles(role) # выдаем автору роль

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question