Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

394
Vistas
Delete Discord.js v13 slash command that doesnt exist

lately, I started working on a discord bot and added slash commands.

I noticed that I have a ping(replies with pong) command that I didn't create or I did and I can't get rid of it.

Here is my interactionHandler.js

const { REST } = require("@discordjs/rest");
const { Routes } = require("discord-api-types/v9");

module.exports = async (err, files, client) => {
  if (err) return console.error(err);

  client.interactionsArray = [];
  files.forEach((file) => {
    const interaction = require(`./../interactions/${file}`);
    client.interactions.set(interaction.data.name, interaction);
    client.interactionsArray.push(interaction.data.toJSON());
  });

  const rest = new REST({ version: "9" }).setToken(process.env.DISCORD_TOKEN);
  
  (async () => {
    try {
      // console.log("Refreshing slash command list");
      // const guildIds = await client.guilds.cache.map((guild) => guild.id);
      // const clientId = await client.user.id;
      // guildIds.forEach(async (guildId) => {
      //   await rest.put(Routes.applicationGuildCommands(clientId, guildId), {
      //     body: client.interactionsArray,
      //   });
      // });
      await rest.put(
            Routes.applicationGuildCommands("934895917453168653", "967384688069066852"),
            { body: client.interactionsArray},
        );

      console.log("Successfully refreshed slash command list");
    } catch (error) {
      console.error(error);
    }
  })();
};

Is there a way to delete the command because I cant find a way. I was thinking of getting the ID of the command but I don't know how. Thanks for all the helpers :) Discord.js v13

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

These commands may not be refreshing because of 2 reasons:

  • These commands may be global commands to change that to refreshing global (instead of guild) commands replace Routes.applicationGuildCommands to Routes.applicationCommands
  • These commands may be from a different guild which in the case you should change the guild ID

To figure out the problem you should do client.application.commands.fetch() to get all your commands and then console.log() the result.

Example

//This will fetch all your slash commands
const commands = await client.application.commands.fetch();
//Returns a collection of application commands
console.log(commands);
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda