Permission to add role?

help im trying to make a bot, it worked perfectly on my test server with test accounts but then i put it into production and now it's getting this error:
1|pixel school bot | DiscordAPIError[50013]: Missing Permissions
1|pixel school bot | at SequentialHandler.runRequest (/home/lb/pixel-school-bot/node_modules/@discordjs/rest/dist/index.js:933:15)
1|pixel school bot | at processTicksAndRejections (node:internal/process/task_queues:96:5)
1|pixel school bot | at async SequentialHandler.queueRequest (/home/lb/pixel-school-bot/node_modules/@discordjs/rest/dist/index.js:712:14)
1|pixel school bot | at async REST.request (/home/lb/pixel-school-bot/node_modules/@discordjs/rest/dist/index.js:1321:22)
1|pixel school bot | at async GuildMemberRoleManager.add (/home/lb/pixel-school-bot/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:131:7)
1|pixel school bot | at async Client.<anonymous> (file:///home/lb/pixel-school-bot/commands/create-registration-channel.js:145:2) {
1|pixel school bot | rawError: { message: 'Missing Permissions', code: 50013 },
1|pixel school bot | code: 50013,
1|pixel school bot | status: 403,
1|pixel school bot | method: 'PUT',
1|pixel school bot | url: 'https://discord.com/api/v10/guilds/1089983841193709689/members/324534693024366603/roles/1090747389159157931',
1|pixel school bot | requestBody: { files: undefined, json: undefined }
1|pixel school bot | }
1|pixel school bot | DiscordAPIError[50013]: Missing Permissions
1|pixel school bot | at SequentialHandler.runRequest (/home/lb/pixel-school-bot/node_modules/@discordjs/rest/dist/index.js:933:15)
1|pixel school bot | at processTicksAndRejections (node:internal/process/task_queues:96:5)
1|pixel school bot | at async SequentialHandler.queueRequest (/home/lb/pixel-school-bot/node_modules/@discordjs/rest/dist/index.js:712:14)
1|pixel school bot | at async REST.request (/home/lb/pixel-school-bot/node_modules/@discordjs/rest/dist/index.js:1321:22)
1|pixel school bot | at async GuildMemberRoleManager.add (/home/lb/pixel-school-bot/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:131:7)
1|pixel school bot | at async Client.<anonymous> (file:///home/lb/pixel-school-bot/commands/create-registration-channel.js:145:2) {
1|pixel school bot | rawError: { message: 'Missing Permissions', code: 50013 },
1|pixel school bot | code: 50013,
1|pixel school bot | status: 403,
1|pixel school bot | method: 'PUT',
1|pixel school bot | url: 'https://discord.com/api/v10/guilds/1089983841193709689/members/324534693024366603/roles/1090747389159157931',
1|pixel school bot | requestBody: { files: undefined, json: undefined }
1|pixel school bot | }
The error is from line 145:
await guildMember.roles.add(studentRole);
await guildMember.roles.add(studentRole);
I gave my bot admin permissions when creating the invite link, so what could the problem be? Shouldn't it be able to do literally everything?
11 Replies
d.js toolkit
d.js toolkit15mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
skeddles
skeddles15mo ago
its not!
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs15mo ago
Documentation suggestion for @skeddles:property Role#managed Whether or not the role is managed by an external service
skeddles
skeddles15mo ago
i see, that's makes sense
Idris
Idris15mo ago
check if this is true
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Idris
Idris15mo ago
yeah I know I told him to check this property before adding a role
skeddles
skeddles15mo ago
does discord create a new role automatically for each bot?
Idris
Idris15mo ago
yeah if the bot scope enabled