Missing Access for Slash Commands

Issue

Heres the error message:

PS C:\Users\User\Documents\Discord Bot> node .
ready
C:\Users\User\Documents\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:154
      throw new DiscordAPIError(request.path, data, request.method, res.status);
            ^

DiscordAPIError: Missing Access
    at RequestHandler.execute (C:\Users\User\Documents\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
    at processTicksAndRejections (node:internal/process/task_queues:93:5)
    at async RequestHandler.push (C:\Users\User\Documents\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:39:14) {
  method: 'post',
  path: '/applications/723863781607997451/guilds/722043668730740788/commands',
  code: 50001,
  httpStatus: 403
}

Help is appreciated.
This is my first post on stackoverflow, so if I’m posting something wrong, please tell me!

Solution

This error is caused because your Discord Bot does not have permission to create commands for that server.

There is two ways to fix this.

Option 1 – In-App Authorization

You should first navigate to the Discord Developer Portal then you should click on the bot that you are getting the issue with.

You will then be prompted with this page:

Splash page for the bots Management Panel in Developer Portal

You should then click on the "OAuth" page, highlighted in red on the above screenshot.

Once you are on this page, you should find the "Default Authorization Link" setting and set it to "In-App Authorization".

Default Authorization Link setting on the OAuth Page of the Developer Portal

Once that option is selected another option will pop up asking what permissions the bot will ask the user for, you can see the screenshot below.

Scope & Bot Permission settings for Discord Bot

Select bot and application.commands then select the permissions that your bot requires.

Then save your changes.
Save your changes

You will need to re-authorize your bot to the guild before it will work, you do not need to kick it – just click on your bot and click "Add to Server" and re-add it to your guild.

Option 2 – URL Generation

You should first navigate to the Discord Developer Portal then you should click on the bot that you are getting the issue with.

Once you are on that page, you should access the OAuth sub-menu titled "URL Generation" as seen below.

URL Generator

Once you are on this page, you will be presented with a similar output to Option 1, you should configure the scope to be bot and application.commands and then request permissions as your bot needs.

Note

You should use both of these with your Discord bot, you should use Option 1 to setup your in-app authorization permissions and then use Option 2 to get a URL for Discord Bot lists, etc.

Answered By – Liam

Answer Checked By – Clifford M. (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.