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

162
Vistas
I'm in need of help registering for all guilds globally, can someone assist me?

I'm looking to register for all guilds globally instead of registering for just my guild ID, just so I can use slash commands in my friend's server (plus any other server it's in), yet I don't know how. I'm a bit new to discord.js.

I was wondering if someone could help me register for all guilds globally...

Extra information - I'm following reconlx's Discord.js v13 tutorials.

This is the part of my code which I need help looking at and modifying. There's a line in his command handler talking about registering for all guilds at await client.application.commands.set(arrayOfSlashCommands);, yet I'm not sure what it means...

client.on("ready", async () => {
        // Register for a single guild
        const guild = client.guilds.cache.get("938823675535319050")
        await guild.commands.set(arrayOfSlashCommands).then((cmd) => {
            const getRoles = (commandName) => {
                const permissions = arrayOfSlashCommands.find(
                    (x) => x.name === commandName
                ).userPermissions;

                if(!permissions) return null;
                return guild.roles.cache.filter(
                    (x) => x.permissions.has(permissions) && !x.managed
                );
            };

            const fullPermissions = cmd.reduce((accumulator, x) => {
                const roles = getRoles(x.name);
                if(!roles) return accumulator;

                const permissions = roles.reduce((a, v) => {
                    return [
                        ...a,
                        {
                            id: v.id,
                            type: 'ROLE',
                            permission: true,
                        },
                    ];
                }, []);

                return [
                    ...accumulator,
                    {
                        id: x.id,
                        permissions,
                    },
                ];
            }, []);

            guild.commands.permissions.set({ fullPermissions });
        });

        // Register for all the guilds the bot is in
        // await client.application.commands.set(arrayOfSlashCommands);
    });

Looking forward to some solutions, if you could assist, it would help a lot.

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

0

You can register global commands using the Client.application.commands.set() method, passing in an Array of ApplicationCommandDataResolvables into the method. However, please be aware a caveat of global commands is that they take up to an hour for changes to reflect across Discord.

See this:

client.application.commands.set(commands)
// ^^^                          ^^^^^^^^
// Client is your Discord.Client  Commands is the list of 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