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

211
Views
¿Comando de barra diagonal Discord JS zodError?

Cada vez que ejecuto mi código, recibo un error extraño de mi archivo de comando de barra inclinada. Aquí está el error. He comprobado los nombres en mayúsculas en el comando de barra diagonal y en mi controlador de comandos, aunque parece que no puedo resolverlo, ¿quizás puedas ayudarme?

 { "code": "invalid_type", "expected": "string", "received": "undefined", "path": [], "message": "Required" } ] at handleResult (/home/runner/MI6Agent/node_modules/zod/lib/types.js:28:23) at ZodString.safeParse (/home/runner/MI6Agent/node_modules/zod/lib/types.js:140:16) at ZodString.parse (/home/runner/MI6Agent/node_modules/zod/lib/types.js:120:29) at Y (/home/runner/MI6Agent/node_modules/@discordjs/builders/dist/index.js:3:5798) at b (/home/runner/MI6Agent/node_modules/@discordjs/builders/dist/index.js:3:5893) at te.runRequiredValidations (/home/runner/MI6Agent/node_modules/@discordjs/builders/dist/index.js:3:6930) at te.toJSON (/home/runner/MI6Agent/node_modules/@discordjs/builders/dist/index.js:3:7116) at /home/runner/MI6Agent/node_modules/@discordjs/builders/dist/index.js:3:12954 at Array.map (<anonymous>) at MixedClass.toJSON (/home/runner/MI6Agent/node_modules/@discordjs/builders/dist/index.js:3:12945) at /home/runner/MI6Agent/node_modules/@discordjs/builders/dist/index.js:3:13239 at Array.map (<anonymous>) at MixedClass.toJSON (/home/runner/MI6Agent/node_modules/@discordjs/builders/dist/index.js:3:13230) at Object.<anonymous> (/home/runner/MI6Agent/index.js:33:30) at Module._compile (node:internal/modules/cjs/loader:1101:14)

Aquí está mi comando de barra.

 const { SlashCommandBuilder } = require('@discordjs/builders'); module.exports = { data: new SlashCommandBuilder() .setName('inform') .setDescription('Informs the specified user in DMs.') .addSubcommand(command => command .setName('channel') .setDescription('Sends a message to an channel') .addChannelOption(option => option.setName('target').setDescription('Select the target channel').setRequired(true)).addBooleanOption(option => option.setName('incognito').setRequired(true))) .addSubcommand(command => command .setName('member') .setDescription('Sends a message to an member') .addUserOption(option => option.setName('target').setDescription('Select the target user').setRequired(true)).addBooleanOption(option => option.setName('incognito').setRequired(true))) .addSubcommand(command => command .setName('role') .setDescription('Sends a message to an member') .addRoleOption(option => option.setName('target').setDescription('Select the target role').setRequired(true)).addBooleanOption(option => option.setName('incognito').setRequired(true))), }
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Hay una pista en el error: recibió una cadena undefined pero esperada. Esto significa que te estás perdiendo algo (en lugar de que algo sea una cadena no válida, por ejemplo, con letras mayúsculas).

Debe agregar descripciones para la opción booleana de incognito (agregue un .setDescription() a la cadena de métodos).

Para obtener más información sobre qué campos son obligatorios para los comandos y sus opciones, consulta los documentos de la API de Discord .

about 4 years ago · Santiago Gelvez 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!