Purple Ghost
Purple Ghost
DIAdiscord.js - Imagine an app
Created by Purple Ghost on 8/18/2024 in #djs-questions
Discord slash commands aren't registering
require('dotenv').config();
const { REST, Routes } = require('discord.js');

const commands = [
{
name: 'hey',
description: 'Replies with hey!',
}
];

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 succesfully!");
} catch (error) {
console.log(`There is an error: ${error}`);
}
})();
require('dotenv').config();
const { REST, Routes } = require('discord.js');

const commands = [
{
name: 'hey',
description: 'Replies with hey!',
}
];

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 succesfully!");
} catch (error) {
console.log(`There is an error: ${error}`);
}
})();
I followed the tutorial on youtube. I rewatched it. Everything is good with the script. The slash command isn't registering. It isn't showing in the / space. Before you all start, yes i have invited my bot with application command permission, i reinvited it 3 times. I reseted the token. I've ran the script. I have no idea what's wrong.
73 replies