Closed KosmicAnomaly closed 2 years ago
Since add_roles
can take up multiple Snowflake
objects, my guess is that it misinterpreted your reason as a snowflake object which gave that error. A simple fix to this is to make your reason a kwarg (i.e. await message.author.add_roles(roleObj, reason="Adding a role")
).
Since
add_roles
can take up multipleSnowflake
objects, my guess is that it misinterpreted your reason as a snowflake object which gave that error. A simple fix to this is to make your reason a kwarg (i.e.await message.author.add_roles(roleObj, reason="Adding a role")
).
Yep that ended up being the issue, can't believe I missed that. Thanks! 😅
Summary
Role object converted to str
Reproduction Steps
Passed a role object into member.add_roles()
Minimal Reproducible Code
Expected Results
Add the role to the member like normal
Actual Results
Ignoring exception in on_message Traceback (most recent call last): File "C:\Users\ree\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 352, in _run_event await coro(*args, **kwargs) File "C:\Users\ree\Desktop\Code\DiscordBots\BlackHole\Modules\Fun\Leveling.py", line 478, in on_message await message.author.add_roles(roleObj, "Adding a role") File "C:\Users\ree\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\member.py", line 950, in add_roles await req(guild_id, user_id, role.id, reason=reason) AttributeError: 'str' object has no attribute 'id'
Intents
discord.Intents.all()
System Information
Checklist
Additional Context
No response