Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

159
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!