i create a bot can change my roles away but it get err when i am a roles it can delete a roles and change to b roles and change back to a roles
myname.add_roles(rolesID)
i open dev mod and use my descord and set myname = myid but i get
AttributeError: 'int' object has no attribute 'add_roles'
so i change myid to my discord username and # i get
AttributeError: 'str' object has no attribute 'add_roles'
can someone help me?
You need to actually get the member object from your id.
For example:
guild_obj = client.get_guild(Your Guild Id here)
member_obj = guild_obj.get_member(Your Member Id here)
await member_obj.add_roles(rolesID)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.