D
D
Dark_sir2020-06-10 06:14:14
Python
Dark_sir, 2020-06-10 06:14:14

How to make the bot issue roles?

I am writing my own bot, and I need that when sending a message like "Give @nickname @role" the player will be given the role that I specified?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Guerro69, 2020-06-21
@Guerro69

@bot.command(pass_context=True)
async def Выдать(ctx, member: discord.Member, arg):
    id = re.findall(r'\d+', arg)[0]
    role = discord.utils.get(ctx.message.guild.roles, id=int(id))
    await member.add_roles(role, reason=None, atomic=True)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question