antoinemcx / Structure-Discord-Bot

🚀 Command, slash command & event handler - Discord Bot Template (v14)
https://discord.gg/G6WQsMQShZ
MIT License
86 stars 10 forks source link

Update slash.js #6

Closed Artiixx closed 1 year ago

Artiixx commented 1 year ago

Patch of the slash.js file to remove the Discord API error.

Started refreshing application (/) commands.
w[0]: 401: Unauthorized
    at Z.runRequest (C:\Users\utilisateur\Desktop\Veloxy v.0.1\node_modules\@discordjs\rest\dist\index.js:7:581)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Z.queueRequest (C:\Users\utilisateur\Desktop\Veloxy v.0.1\node_modules\@discordjs\rest\dist\index.js:5:2989)
    at async C:\Users\utilisateur\Desktop\Veloxy v.0.1\slash.js:20:5 {
  rawError: { message: '401: Unauthorized', code: 0 },
  code: 0,
  status: 401,
  method: 'put',
  url: 'https://discord.com/api/v9/applications/1040769310131503255/guilds/1040770536478875678/commands',
  requestBody: { attachments: undefined, json: [ [Object] ] }
}
antoinemcx commented 1 year ago

You didn't change anything in the code except changing GuildCommands to applicationCommands. I can't approve your pull request sorry x)

Moreover, the error you've had is probably just that you didn't invite the bot with the application.commands scope. Anyways, if the problem's still present please open a post in the "my-github-repos" forum channel on my discord server.