M
M
MARCUS272021-12-24 15:28:05
Python
MARCUS27, 2021-12-24 15:28:05

How to make the issuance of roles through the team?

Failed to issue moderator role on command. The bot gives an error after the command.

Here is the code:

@client.command()
@commands.has_permissions(administrator=True)

async def moder(ctx, member: discord.Member):
  await ctx.channel.purge(limit = 1)

  moder_role = discord.utils.get(ctx.message.guild.roles, name = "moderator")
  await member.add_roles(moder_role)
  await ctx.send(f'пользователь {member.mention} стал новым модератором сервера')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
desaki, 2021-12-24
@MARCUS27

I think the solution is:

moder_role = discord.utils.get(ctx.message.guild.roles, id = "id роли")
await member.add_roles(moder_role)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question