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 toolkit14mo 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/luna14mo ago
well, the error is clear either your bot does not have permissions to ban people
not Kuma.
not Kuma.14mo ago
discord.js@14.11.0 node v18.16.0
treble/luna
treble/luna14mo ago
or you are trying to ban someone with a higher role
not Kuma.
not Kuma.14mo 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
urretf14mo ago
the bot needs to be higher
not Kuma.
not Kuma.14mo ago
it is it is on the top
treble/luna
treble/luna14mo ago
your error disagrees either your bot does not have permission, or the member is above the bot
urretf
urretf14mo 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/luna14mo ago
the last one would throw a different error
not Kuma.
not Kuma.14mo ago
not Kuma.
not Kuma.14mo ago
im owner, and bot is on top
urretf
urretf14mo ago
double check that the bot actually has the Ban Members permission
treble/luna
treble/luna14mo ago
and the member you are trying to ban is? / has which roles
urretf
urretf14mo ago
hold on
Want results from more Discord servers?
Add your server