'How to fix slash commands disappearing after one use

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

Video url

    
    // 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 


Solution 1:[1]

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.

See picture below: discord.dev

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gh0st