Discord.py: Setting a role on member join

Created on 15 Jan 2018  路  4Comments  路  Source: Rapptz/discord.py

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
screenshot_1

stale

Most helpful comment

Please don't necrobump issues.
@Vexs already addressed this.

All 4 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

synbitz picture synbitz  路  3Comments

adhoc92 picture adhoc92  路  3Comments

Spyder-exe picture Spyder-exe  路  3Comments

JackL0 picture JackL0  路  3Comments

j0hnmeow picture j0hnmeow  路  3Comments