L
L
lotuzakim2020-09-20 18:35:16
Python
lotuzakim, 2020-09-20 18:35:16

How to issue a role in discord.py?

I'm making a bot for my Discord server. I want to issue a role to a participant on a bot command.
It should look like this:
User : !command_name @User
Bot : Member @User verified successfully.
Explain how to do it?
PS I am new to discord.py

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Nevzorov, 2020-09-20
@lotuzakim

Member.add_roles

@commands.command()
async def command_name(ctx, user: discord.Member):
    if role := ctx.guild.get_role(779490160819217032)
        await user.add_roles(role)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question