Ask coding questions

← Back to all posts
How can I make the bot give me a certain role when I type the command for it?
Popzular (2)

need help. dont know what

Comments
hotnewtop
ErrorNoInternet (13)

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)

ErrorNoInternet (13)

@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")