Hi I added slash commands for the first time in js and like after one use the commands disappear as shown in the video below
// Slash Commands
const slashCommands = await globPromise(
`${process.cwd()}/SlashCommands/*/*.js`
);
const arrayOfSlashCommands = [];
slashCommands.map((value) => {
const file = require(value);
if (!file?.name) return;
client.slashCommands.set(file.name, file);
if (["MESSAGE", "USER"].includes(file.type)) delete file.description;
arrayOfSlashCommands.push(file);
});
client.on("ready", async () => {
// Register for a single guild
await client.guilds.cache
.get("900379296407896075")
.commands.set(arrayOfSlashCommands);
console.log('[Slash cmds] commands were loaded')
// Register for all the guilds the bot is in
// await client.application.commands.set(arrayOfSlashCommands);
});```
slash command handler that I use
You need to redeploy your bot making sure that you have selected bot and application.commands, then set the permissions and use the link at the bottom to re-invite your bot to the guild.