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

591
Vistas
HTTP error code 405 Invalid method for DiscordJS bot

I'm making a new discord bot to help me learn discordjs and JS in general but I keep getting the following HTTP error and cannot find a way to resolve it. Using discord.js version 13.8.0

See error message:

DiscordAPIError: 405: Method Not Allowed
    at RequestHandler.execute (C:\Users\Offic\Desktop\___\LearningBot\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (C:\Users\Offic\Desktop\___\LearningBot\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
    at async ApplicationCommandPermissionsManager.set (C:\Users\Offic\Desktop\___\LearningBot\node_modules\discord.js\src\managers\ApplicationCommandPermissionsManager.js:186:18)
    at async C:\Users\Offic\Desktop\___\LearningBot\handlers\commands.js:66:12 {
  method: 'put',
  path: '/applications/986771474943709244/guilds/986441402735022140/commands/permissions',
  code: 0,
  httpStatus: 405,
  requestData: { json: [], files: [] }

The following is the faulty code snippet:

    client.on("ready", async () => {
        const MainGuild = await client.guilds.cache.get(process.env.GUILDID);

        MainGuild.commands.set(commandsarray).then(async (command) => {
           const Roles = (commandname) => {
            const cmdperms = commandsarray.find((c) => c.name === commandname).permission;
            if(!cmdperms) return null;

            return MainGuild.roles.cache.filter((r) => r.permissions.has(cmdperms));
           }

           const fullPermissions = command.reduce((accumulator, r) => {
                const roles = Roles(r.name);
                if(!roles) return accumulator;

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

           await MainGuild.commands.permissions.set({ fullPermissions });
        });
    });

The section where the error occurs is:

await MainGuild.commands.permissions.set({ fullPermissions });
about 4 years ago · Juan Pablo Isaza
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