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

403
Vistas
Use Slash Commands in all servers where have a bot without GuildID (Discord.js v12)

I want people to be able to use Slash Commands against my bot on any server, as long as the bot is there. I have further granted the bot application.commands permission. I was referencing this answer, but it seems to require the server's GuildID. Can I allow anyone using Slash Commands to come to my bot without a GuildID? And how do people use it? (I use Commands Handler)

sorry for my bad english

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

0

You probably want to use a global slash command. Global meaning that it works across all guilds the bot is in and you don't need to provide any guild id.

client.on("ready", () => {

    // Register global slash command
    client.api.applications(client.user.id).commands.post({
        data: {
            name: "hello",
            description: "Say 'Hello, World!'"
        }
    });

    // Listen for an interaction (e.g. user typed command)
    client.ws.on("INTERACTION_CREATE", (interaction) => {
        // Access command properties
        const commandId = interaction.data.id;
        const commandName = interaction.data.name;
        
        // Reply only to commands with name 'hello'
        if (commandName == "hello") {
            // Reply to an interaction
            client.api.interactions(interaction.id, interaction.token).callback.post({
                data: {
                    type: 4,
                    data: {
                        content: "Hello, World!"
                    }
                }
            });
        }
    });

});

This is how would a user use your command:

enter image description here

And the reply looks like this:

enter image description here

over 4 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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda