Provide OAuth2 bearer token in discord js

Viewed 54

I am getting this error:

Editing application command permissions requires an OAuth2 bearer token, but none was provided

trying to set permissions to a command in discord js v14. Does anyone have an idea how I can fix it?

const fullPermissions = [
    {
        id: "command ID",
        permissions: [{
            id: "user id",
            type: "USER",
            permission: false
        }]
    }
]
client.guilds.cache.get("server id").commands.permissions.set({
    fullPermissions
})
1 Answers

I hope that will help you solve your problem

guild.commands.permissions.set({ token: 'TotallyRealToken', permissions: [
  {
    id: '123456789012345678',
    permissions: [{
      id: '876543210987654321',
      type: ApplicationCommandPermissionType.User,
      permission: false,
    }],
  },
]})
  .then(console.log)
  .catch(console.error);

From: Discord

Related