error 405 method not allowed

these are my codes ( and the file name is 'register-commands.js' )
require('dotenv').config();
const { REST, Routes } = require('discord.js')

const commands = [
{
name: 'rps',
description: '가위바위보 한 판 뜨자'
},
];

const rest = new REST({ version: '10' }).setToken(process.env.TOKEN);

(async () => {
try {
console.log('registering slash command...')
await rest.put(
Routes.applicationGuildCommand(process.env.CLIENT_ID, process.env.GUILD_ID),
{ body: commands }
)

console.log('slash command were registerd sucessfully')
} catch (error) {
console.log(`There was an error, ${error}`);
}
})();
require('dotenv').config();
const { REST, Routes } = require('discord.js')

const commands = [
{
name: 'rps',
description: '가위바위보 한 판 뜨자'
},
];

const rest = new REST({ version: '10' }).setToken(process.env.TOKEN);

(async () => {
try {
console.log('registering slash command...')
await rest.put(
Routes.applicationGuildCommand(process.env.CLIENT_ID, process.env.GUILD_ID),
{ body: commands }
)

console.log('slash command were registerd sucessfully')
} catch (error) {
console.log(`There was an error, ${error}`);
}
})();
so I typed 'node src/register-commands.js' in the terminal, and it says, 'Debugger attached. registering slash command... There was an error, DiscordAPIError[0]: 405: Method Not Allowed Waiting for the debugger to disconnect...' How can I fix it to work?
2 Replies
d.js toolkit
d.js toolkit17mo 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!
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server