I'm totally new to phyton programming and I was trying to create a bot for discord, I know the basics and I was trying to add a role as soon as a new member joined the server, how can I do that?
I made a test code but it is not working

You should be able to get better help by joining the d.py support server. Use this invite to join :) https://discord.gg/r3sSKJJ
You're making a lot of basic mistakes.
get_user_info takes in an ID, and gets basic user info from the api- it also has a rather strict ratelimit, and is a coro, needing to be awaited- and since you already have the user information in the form of a member object, pointless here.
Furthermore, you then check if a string is none...?
Anyway, add_roles takes in a member object and a role object. You're providing it with a list of roles the member has, and a string. Take a look at this this in the FAQ ,as well as the documentation on add_roles
@iDragoon By the way. your line role='id' would not work. You must use discord.Object(id='ID HERE')
Please don't necrobump issues.
@Vexs already addressed this.
Most helpful comment
Please don't necrobump issues.
@Vexs already addressed this.