kwiee
kwiee
DIAdiscord.js - Imagine an app
Created by kwiee on 1/3/2025 in #djs-questions
slash commands not showing up
i have a file register-commands.jswhere i register slash commands but it is not appearing in discord client
require('dotenv').config();
const { REST,Routes} = require("discord.js")


const commands = [
{
name:'ping',
description:'pong',
}
]

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

(async () => {
try {
console.log('registering slash commands')
await rest.put(
Routes.applicationGuildCommands(
process.env.CLIENT_ID,
process.env.GUILD_ID)
),
{
body: commands
};
console.log('registered slash commands');
} catch (error) {
console.log(`there was an error error: ${error}`);

}

})();
require('dotenv').config();
const { REST,Routes} = require("discord.js")


const commands = [
{
name:'ping',
description:'pong',
}
]

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

(async () => {
try {
console.log('registering slash commands')
await rest.put(
Routes.applicationGuildCommands(
process.env.CLIENT_ID,
process.env.GUILD_ID)
),
{
body: commands
};
console.log('registered slash commands');
} catch (error) {
console.log(`there was an error error: ${error}`);

}

})();
output : registering slash commands registered slash commands
23 replies