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

286
Views
¿Por qué la API de Discord devuelve el error 405 por agregar un comando de barra a un gremio?

Actualmente estoy haciendo un bot en discord.js, y estoy tratando de construir un controlador de comandos (específicamente para comandos de barra). Desafortunadamente, cada vez que ejecuto el código, devuelve un error 405 de la API de discord. aquí está el error:

 DiscordAPIError[0]: 405: Method Not Allowed at SequentialHandler.runRequest (/home/ayman/Documents/Projects/image-bot/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.js:198:23) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async SequentialHandler.queueRequest (/home/ayman/Documents/Projects/image-bot/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.js:99:20) at async /home/ayman/Documents/Projects/image-bot/src/main.js:35:5 { rawError: { message: '405: Method Not Allowed', code: 0 }, code: 0, status: 405, method: 'put', url: 'https://discord.com/api/v9/applications/921468165576347658/guilds/545334770368774146/commands/undefined' }

Y aquí está el código problemático:

 (async () => { try { if (process.env.ENV === "production") { await rest.put(Routes.applicationCommand(CLIENT_ID), { body: commands, }); console.log("Commands successfully registered globally."); } else { await rest.put(Routes.applicationGuildCommand(CLIENT_ID, process.env.GUILD_ID), { body: commands, }); console.log("Commands successfully registered locally."); } } catch (err) { if (err) console.error(err); } })();

¿Hay alguna razón por la que esto está sucediendo? ¡Gracias por cualquier ayuda!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Estás usando el método incorrecto, es applicationGuildCommands :)

código fuente de referencia

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!