Skip to content
Sign upLog in
← Back to Community

How can I make the bot give me a certain role when I type the command for it?

Profile icon
Popzular

need help. dont know what

Voters
Profile icon
Xtuberis
Profile icon
ErrorNoInternet
Profile icon
Popzular
Comments
hotnewtop
Profile icon
ErrorNoInternet

You need to specify a role first, then add the role to the user.
Example code:

adminRole = discord.utils.get(message.author.guild.roles, name = "Admin")
await message.author.add_roles(adminRole)

Profile icon
Popzular

@ErrorNoInternet
what am I missing?

Profile icon
ErrorNoInternet

@Popzular
Nothing else is missing, please note that you need a role on your server called "Test" for the command to work. I don't know how to create roles as a bot, but I think its:
await client.create_role(message.author.server, name="role name")