discord.py add role on member join

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

async def on_member_join(member):
  role = get(member.guild.roles, id=role_id)
  await member.add_roles(role)

Here is what the above code is Doing:
1. We’re importing the discord.py library and the commands extension.
2. We’re creating a new client object, which will be used to interact with Discord.
3. We’re creating a new event, which will be called when a member joins the server.
4. We’re getting the role object from the server, using the role ID.
5. We’re adding the role to the member.