Node: 115 Discord API Error

Hi I made a bot . Its not mine first time . But its my first time when i am getting Discord Api error after activating my bot . The bot don’t take down but showing this error everytime when i restart . Can someone explain why i am facing this error !
(node:115) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions

at RequestHandler.execute (/rbd/pnpm-volume/eaf057ce-040c-41f9-b26f-4cade15fb664/node_modules/.registry.npmjs.org/discord.js/12.4.1/node_modules/discord.js/src/rest/RequestHandler.js:154:13)

at processTicksAndRejections (internal/process/task_queues.js:88:5)

at async RequestHandler.push (/rbd/pnpm-volume/eaf057ce-040c-41f9-b26f-4cade15fb664/node_modules/.registry.npmjs.org/discord.js/12.4.1/node_modules/discord.js/src/rest/RequestHandler.js:39:14)

(node:115) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

(node:115) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

DiscordAPIError: Missing Permissions

I suppose this error fired when you tried to do an admin action but didn’t have permissions. Can you make sure your bot has admin privileges?

1 Like

@CarlyRaeJepsenStan I had perm and even bot had administrator perm !

Strange, can you share a project link or some code?

Sure but i m so tired even its 3:40 am here. i will provide tomorrow

1 Like

Hey!

I see… If you’re trying to did that Action, Make sure the Role is At the top of Non-Admin Role.

Also some Notice, Make sure your Project is Private because someone can Get your Token (if your token is at config.json or at some config file) at your Config File!

1 Like

If your token is stored in .env you’re ok. As yonle says, make sure your bot’s role is on top of whatever person it’s preforming the action on otherwise it will fail. For example my bot cannot nickname an admin because it’s role is at the bottom of the roles list.
I think this might not apply to kicking though because a low bot may be able to kick a higher person