Missing permissions while trying to ban someone

throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50013]: Missing Permissions
at handleErrors (C:\Users\lukas\Desktop\bot\node_modules\@discordjs\rest\dist\index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\lukas\Desktop\bot\node_modules\@discordjs\rest\dist\index.js:1021:23)
at async SequentialHandler.queueRequest (C:\Users\lukas\Desktop\bot\node_modules\@discordjs\rest\dist\index.js:862:14)
at async REST.request (C:\Users\lukas\Desktop\bot\node_modules\@discordjs\rest\dist\index.js:1387:22)
at async GuildBanManager.create (C:\Users\lukas\Desktop\bot\node_modules\discord.js\src\managers\GuildBanManager.js:169:5) {
requestBody: { files: undefined, json: { delete_message_seconds: undefined } },
rawError: { message: 'Missing Permissions', code: 50013 },
code: 50013,
status: 403,
method: 'PUT',
url: 'https://discord.com/api/v10/guilds/1138944612321480834/bans/454341168344596483'
}
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50013]: Missing Permissions
at handleErrors (C:\Users\lukas\Desktop\bot\node_modules\@discordjs\rest\dist\index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\lukas\Desktop\bot\node_modules\@discordjs\rest\dist\index.js:1021:23)
at async SequentialHandler.queueRequest (C:\Users\lukas\Desktop\bot\node_modules\@discordjs\rest\dist\index.js:862:14)
at async REST.request (C:\Users\lukas\Desktop\bot\node_modules\@discordjs\rest\dist\index.js:1387:22)
at async GuildBanManager.create (C:\Users\lukas\Desktop\bot\node_modules\discord.js\src\managers\GuildBanManager.js:169:5) {
requestBody: { files: undefined, json: { delete_message_seconds: undefined } },
rawError: { message: 'Missing Permissions', code: 50013 },
code: 50013,
status: 403,
method: 'PUT',
url: 'https://discord.com/api/v10/guilds/1138944612321480834/bans/454341168344596483'
}
when executing
member.ban({ reason: 'Sorry, there is no place for mean people.' }).then(banned => console.log(`Użytkownik o nicku ${banned.name} został/a zbanowany/a`));
member.ban({ reason: 'Sorry, there is no place for mean people.' }).then(banned => console.log(`Użytkownik o nicku ${banned.name} został/a zbanowany/a`));
22 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
well, the error is clear either your bot does not have permissions to ban people
Not Kuma anymore
Not Kuma anymoreOP17mo ago
[email protected] node v18.16.0
treble/luna
treble/luna17mo ago
or you are trying to ban someone with a higher role
Not Kuma anymore
Not Kuma anymoreOP17mo ago
It has. I checked. But ill check second suggestion :P But i was running this command as a owner on someone who was lower in hierarchy so
urretf
urretf17mo ago
the bot needs to be higher
Not Kuma anymore
Not Kuma anymoreOP17mo ago
it is it is on the top
treble/luna
treble/luna17mo ago
your error disagrees either your bot does not have permission, or the member is above the bot
urretf
urretf17mo ago
Getting a 403 Forbidden: Missing Permissions Error? For actions involving members, check that - The member's highest role is lower than the bot - The member is not the owner of the server - The server does not have "Require 2fa for moderation" enabled. (If it does, you need to enable 2fa on your own account.)
treble/luna
treble/luna17mo ago
the last one would throw a different error
Not Kuma anymore
Not Kuma anymoreOP17mo ago
Not Kuma anymore
Not Kuma anymoreOP17mo ago
im owner, and bot is on top
urretf
urretf17mo ago
double check that the bot actually has the Ban Members permission
treble/luna
treble/luna17mo ago
and the member you are trying to ban is? / has which roles
urretf
urretf17mo ago
hold on
Not Kuma anymore
Not Kuma anymoreOP17mo ago
urretf
urretf17mo ago
the error says you're trying to ban 454341168344596483, which is your current account which is also the owner
Not Kuma anymore
Not Kuma anymoreOP17mo ago
treble/luna
treble/luna17mo ago
i cannot read any of that
Not Kuma anymore
Not Kuma anymoreOP17mo ago
just 2fa for server wtf
urretf
urretf17mo ago
double check where you set member
Not Kuma anymore
Not Kuma anymoreOP17mo ago
kk, gimme sec DiscordAPIError[60003]: Two factor is required for this operation, but i have 2fa turned on on my acc wtf xD That's kinda funny tho, cuz i've written one banning command before, like 2 days ago and it worked perfectly. I've changed it a little bit to adjust some functionalities and it now only annoy me
Want results from more Discord servers?
Add your server