Answers for "discord.py add role to server"

1

discord.py add role on member join

intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix=',', intents=intents)

@client.event 
async def on_member_join(member):
  role = get(member.guild.roles, id=role_id)
  await member.add_roles(role)
Posted by: Guest on February-01-2021
0

adding roles discord py

# If you need this in a bot command
@discord.ext.commands.command()
async def online(ctx):
    role = discord.utils.get(bot.get_guild(ctx.guild.id).roles, id ="Role ID")
    await member.add_roles(role)
Posted by: Guest on June-24-2021

Code answers related to "discord.py add role to server"

Python Answers by Framework

Browse Popular Code Answers by Language