discord python how to add role code example
Example 1: add self role with discord bot python
@async def on_message(message):
if message.content == "give me admin"
role = discord.utils.get(server.roles, name="Admin")
await client.add_roles(message.author.id, role)
Example 2: add role discord .py
member = message.author
var = discord.utils.get(message.guild.roles, name = "role name")
member.add_role(var)