Bot can't give the roles under

My bot can't give roles even tho the bot got the correct permissions. The bot's role is higher than the role it will provide, and it gives the "Missing access" error.
27 Replies
d.js toolkit
d.js toolkitβ€’6mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - βœ… Marked as resolved by staff
Inky
Inkyβ€’6mo ago
Is the member it’s trying to give roles to the guild owner?
πŸ‡―πŸ‡΅πŸ‡΅πŸ‡­πŸ‡ΈπŸ‡¬ β€’ ZIHYIN
No? wait I don't get your question you're asking whether the bot is trying to assign roles to the guild owner ?
Inky
Inkyβ€’6mo ago
That’s correct
πŸ‡―πŸ‡΅πŸ‡΅πŸ‡­πŸ‡ΈπŸ‡¬ β€’ ZIHYIN
then no, the bot is trying to assign to its members, not the owner
souji
soujiβ€’6mo ago
owner/admin does not matter for role adding/removing the "target" for the action in terms of hierarchy is the role(es) to be added/removed, not the member it is added/removed to/from if you get that error you are definitely trying to remove or add a role from or to the member that is higher than or as high as the apps highest role
πŸ‡―πŸ‡΅πŸ‡΅πŸ‡­πŸ‡ΈπŸ‡¬ β€’ ZIHYIN
I haven't done that, though. I have checked the code multiple times, and the bot is designed to add the role underneath the role it already has. If I set the bot's role higher than the role to be assigned, it should work according to the roles hierarchy
souji
soujiβ€’6mo ago
this has to be true for all roles that are removed/added during a bulk role update - make sure you're not accidentally trying to remove things your app doesn't have perms to remove - those have to be included in the final role list when using the set interfaces
πŸ‡―πŸ‡΅πŸ‡΅πŸ‡­πŸ‡ΈπŸ‡¬ β€’ ZIHYIN
And I coded the bot to add the role specifically named under the bot role and not the id of the role itself
souji
soujiβ€’6mo ago
wait, i thought hierarchy issues don't return missing access anymore :firT: yeah, those do DiscordAPIError[50013]: Missing Permissions
πŸ‡―πŸ‡΅πŸ‡΅πŸ‡­πŸ‡ΈπŸ‡¬ β€’ ZIHYIN
This is what I meant, The bot is adding the role by the name of the role and not the ID of that role, so it's impossible for the bot to add the role higher than the role mentioned
No description
souji
soujiβ€’6mo ago
what's the full error?
souji
soujiβ€’6mo ago
managed roles also throw 50013 :firT:
souji
soujiβ€’6mo ago
not that "managed" refers to twitch subscriber roles or boosters, for example, which cannot be manually assigned oh actually, that endpoint throws missing access if the app is lacking the permission invalid role would throw 10011 unknown member 10007 the only way i can reproduce a 50001 is if the bot doesn't have a role with the permission
πŸ‡―πŸ‡΅πŸ‡΅πŸ‡­πŸ‡ΈπŸ‡¬ β€’ ZIHYIN
The "URL" provided in the error shows the roles/ID I already checked the ID, and it seems correct Yes, but it does I've turned on all the perms
souji
soujiβ€’6mo ago
are you looking at the right bot?
πŸ‡―πŸ‡΅πŸ‡΅πŸ‡­πŸ‡ΈπŸ‡¬ β€’ ZIHYIN
mayhaps the error was on the perms in d.dev?
souji
soujiβ€’6mo ago
?
souji
soujiβ€’6mo ago
would not be the first time someone keeps looking at another bot to check roles at the end of the day, to add a role (since you are using the idempotent route) - the app has to be on the server > else 10004 - the member has to be on the server > if not 10007 - the role has to exist > if not 10011 - the role cannot be managed > if it is 50013 - the moderating entity has to have the MANAGE_ROLES permission on any role the member has (overrides do not count) > else 50001 - the moderating entity has to have a higher role than the role it is trying to add > else 50013 i cannot think of any other requirement for adding a role there's no implicit permissions, those tend to throw 50001 nope, i'm out of ideas
Inky
Inkyβ€’6mo ago
Can you log member.manageable?
πŸ‡―πŸ‡΅πŸ‡΅πŸ‡­πŸ‡ΈπŸ‡¬ β€’ ZIHYIN
This was very fine all works and all the same, but then we turned on the required 2fa and it became all like this, the perms the bot is supposed to have are gone and it doesn't give out roles nor does moderation anymore. I think I know now the issue with the bot it's because the "owner of the bot" hasn't yet turned on his 2fa? I will try that statement and see if that turns out good
Inky
Inkyβ€’6mo ago
Discord has a dedicated error for that tho :Thonk:
πŸ‡―πŸ‡΅πŸ‡΅πŸ‡­πŸ‡ΈπŸ‡¬ β€’ ZIHYIN
Bot is fixed, thank you @souji and @Chewinky for helping <3
souji
soujiβ€’6mo ago
i did indeed miss one :PlayDead: 2fa, gdi well, thanks for raising that again, for future issues we now have a #faq post

Did you find this page helpful?