How do I remove a role from a member

I've been able to add a role this whole time. But I can't seem to remove it. It always gives me an error, says I don't have permission. But the bot is admin. Is the function still member.roles.remove(role) ? Or is that my mistake
3 Replies
d.js toolkit
d.js toolkit17mo 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!
treble/luna
treble/luna17mo ago
administrator has nothing to do with this, its likely because you're removing a role thats higher than the bots role
Noelle
NoelleOP17mo ago
I feel like I overlooked the reason. Any ideas? /home/noel/code/nodejs/discordbot/node_modules/@discordjs/rest/dist/index.js:687 throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData); ^ DiscordAPIError[10062]: Unknown interaction at handleErrors (/home/noel/code/nodejs/discordbot/node_modules/@discordjs/rest/dist/index.js:687:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async BurstHandler.runRequest (/home/noel/code/nodejs/discordbot/node_modules/@discordjs/rest/dist/index.js:786:23) at async _REST.request (/home/noel/code/nodejs/discordbot/node_modules/@discordjs/rest/dist/index.js:1218:22) at async ChatInputCommandInteraction.reply (/home/noel/code/nodejs/discordbot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:111:5) { requestBody: { files: [], json: { type: 4, data: { content: 'noeldoescoding is not muted', tts: false, nonce: undefined, embeds: undefined, components: undefined, username: undefined, avatar_url: undefined, allowed_mentions: undefined, flags: undefined, message_reference: undefined, attachments: undefined, sticker_ids: undefined, thread_name: undefined } } }, rawError: { message: 'Unknown interaction', code: 10062 }, code: 10062, status: 404, method: 'POST', url: 'https://discord.com/api/v10/interactions/1142258175567995013/aW50ZXJhY3Rpb246MTE0MjI1ODE3NTU2Nzk5NTAxMzpuYVVIZlZZSVI5bWhkMTRET1FOYmptZlR0OEV1ZFJReTJvVWpheFp3azE0VFN3NmZnVk5ZblpzMW5ibnE3ZlVwdldjWVY2dEdWRENVSWhtUlJ1bVN4Q0hVUEt6Tk9abHpkVHcyQW9qNWY0OTBoTnpnUDZKRkYwdFFvdEp6TTRnWg/callback' }
Want results from more Discord servers?
Add your server