#How to add adeko roles in discord full
Your full code snippet should look like this: playing = (, name="Playing")Īwait client.add_roles(memberafter, mcrole, playing)Īwait client. Meaning that you can do remove multiple roles in one command as well: await client.remove_roles(memberafter, mcrole, playing) Side note, like add_roles(), remove_roles() works almost the same, it removes role instead of adding them. Or if you wanted to keep the roles in a list, just add an asterisk ( *): addroles = Īwait client.add_roles(memberafter, *addroles)
Therefore, your add_roles command needs to be changed to: await client.add_roles(memberafter, mcrole, playing) In fact, the * means that this parameter will take all of the leftover arguments and stores them into a list. The documentation itself is a bit misleading, since it mentions the word, list. *roles – An argument list of Role s to give the member.member ( Member) – The member to give roles to.Member object is not directly modified afterwards until theĬorresponding WebSocket event is received. Under the Roles column, click the little plus button to create a new role. Open Discord, and right-click your server in the column on the left. You must have the proper permissions to use this function. Now that you know the various permissions that can be given to a user on a Discord server, you’re ready to start creating roles. The following is an excerpt of add_role()'s documentation:
I get that it's for the list and should be an argument, but i'm still fairly new and can't figure this out. Mcrole = (, name="Minecraft")Īwait client.add_roles(memberafter, addroles)Īwait client.remove_roles(memberafter, mcrole)Īwait client.remove_roles(memberafter, playing)ĪttributeError: 'list' object as no attribute 'id' Here's the related code: totestafter = str(memberafter.game) I'm using Minecraft as an example in this case. Right now, I can't figure out to add multiple roles at once. I'm coding a bot that will give a person 2 roles, one called 'Playing' and the other dependant on their current game.