• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Pruebas Online
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

528
Vistas
How can I delete a SlashCommand from specific guild? (discord.js)

I am trying to delete a Slash Command in specific guild but when I use the code of documentation it drop me this error:

DiscordAPIError[10063]: Unknown application command at SequentialHandler.runRequest (D:\Bots_Discord\robbie\bot\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.cjs:287:15) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async SequentialHandler.queueRequest (D:\Bots_Discord\robbie\bot\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.cjs:99:14) at async REST.request (D:\Bots_Discord\robbie\bot\node_modules\@discordjs\rest\dist\lib\REST.cjs:52:22) at async Object.run (D:\Bots_Discord\robbie\bot\slashCommands\showCommands.js:15:5) at async Object.run (D:\Bots_Discord\robbie\bot\events\interactionCreate\interactionHandler.js:56:7) { rawError: { message: 'Unknown application command', code: 10063 }, code: 10063, status: 404, method: 'DELETE', url: 'https://discord.com/api/v10/applications/998433286261067807/guilds/998574340419366952/commands/1009128621543264396', requestBody: { files: undefined, json: undefined } }

I use the command id that is in field of guild integrations https://i.stack.imgur.com/x8iSl.png

const { REST } = require('@discordjs/rest')
const { Routes, SlashCommandBuilder } = require('discord.js')
require('dotenv').config()

const rest = new REST({ version: '10' }).setToken(process.env.SECRET_TOKEN);

module.exports = {
  forEveryone: false,
  data: new SlashCommandBuilder()
    .setName('deletecommand')
    .setDescription('delete command'),
  async run(client, interaction) {

    
    await rest.delete(Routes.applicationGuildCommand(client.user.id, interaction.guild.id, '1009128621543264396'))
      .then(() => console.log('Successfully deleted guild command'))
      .catch(console.error)


  }
}

Node Version: v16.16.0 Discord.js Version: v14.2.0

Discord documentation: https://i.stack.imgur.com/jUgpg.png

over 2 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I'm not sure yet, but it looks like you can only delete slash commands from guilds that you have specifically registered the command in ("guild-based commands"). If you have registered the slash command globally, across all guilds, you can't delete it from just one specific guild. The part of the guide that you included a screenshot of has a section right below it on deleting a global command, here's the code snippet from that guide:

// for guild-based commands
rest.delete(Routes.applicationGuildCommand(clientId, guildId, 'commandId'))
    .then(() => console.log('Successfully deleted guild command'))
    .catch(console.error);

// for global commands
rest.delete(Routes.applicationCommand(clientId, 'commandId'))
    .then(() => console.log('Successfully deleted application command'))
    .catch(console.error);
over 2 years ago · Santiago Trujillo 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 Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda