N
N
Nix_ProGramming2021-02-05 08:14:19
Python
Nix_ProGramming, 2021-02-05 08:14:19

How to get the highest server role?

Hello! I would like to know how to get the highest role on the server.
Here is my code:

@client.command()
async def me(ctx):
  emb = discord.Embed(title = 'Info', description = '{}|{}\n{}|{}'.format(ctx.guild.owner, "топ роль сервера", ctx.author.top_role.mention, ctx.author.mention), color = 0x00ff00)
  await ctx.send(embed = emb)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim Nevzorov, 2021-02-05
@Nix_ProGramming

Since the list of roles is returned sorted by position on the server , it is enough to simply get the last element of the list of roles:guild.roles[-1]

Z
Zakhar Guskov, 2021-02-05
@Zuguki

You need to move the bot role up (on the server)

S
s4q, 2021-02-05
@s4q

It's starting to piss me off when people can't read the docs.
https://discordpy.readthedocs.io/en/latest/api.htm...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question