#slash commands not registering

18 messages · Page 1 of 1 (latest)

lethal ember
#

I made a bot with initially 3 commands, then added 3 commands later on, and the new 3 commands won't display anywhere. I ran the exact same bot but on a different account and all 6 commands appear fine. I tried using Routes.applicationGuildCommands using my server's ID instead of Routes.applicationCommands, it worked at first, but the initial 3 commands were duplicated so I kicked and reinvited the bot, and the new 3 commands are now nowhere to be seen.

lucid topazBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • 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!
  • Marked as resolved by staff
ocean wyvern
#

i mean... you kicked the bot, of course the guild commands are gone? not sure what you expected here

#

you can either deploy commands globally, so they are available in any guilds that have the app
or you can deploy them on a specific guild

#

if you remove the app from the guild all its commands in the context of that specific guild are also gone

#

if you add the app to the server again, you have to deploy the commands again

lethal ember
#

I don't get what you're trying to say by "deploy the commands again"

export const registerCommands = async (client: Client) => {
    const rest = new REST({ version: '9' }).setToken(process.env.TOKEN!);
    try {
        await rest.put(
            Routes.applicationGuildCommands(client.user!.id, process.env.GUILD_ID!),
            { body: commands }
        );
    } catch (error) {
        console.error(error);
    }
};
const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.MessageContent,
    ]
});

client.once('ready', async () => {
    console.log(`Logged in as ${client.user?.tag}!`);
    await registerCommands(client);
});

client.on('interactionCreate', async (interaction: Interaction) => {
    if (!interaction.isCommand() && !interaction.isAutocomplete()) return;
    await handleInteraction(interaction);
});

client.login(process.env.TOKEN);

this is what i did

lethal ember
#

weird

#

only 3 are visible

wicked field
#

restart your client

lethal ember
#

you mean the discord app, right? done it a thousand times

delicate nacelle
#

And did you double check the guildId you deploy to to match the guild you check on?

lethal ember
#

yeah, and it starts appearing randomly

#

and there are duplicates (3 app + 6 guild apparently?) which irritates me

#

and the global command still hasn't got updated, it's been 3 days

#

should i create a new app in dev portal?

blazing dune
#

If the commands are duplicated, it means you most likely deployed the same commands globally and to the guild