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

701
Vistas
DiscordAPIError: no se puede enviar un mensaje vacío con Discord incrustado

Mi código es el siguiente:

 const { Client, Intents, MessageEmbed, MessageAttachment } = require("discord.js"); const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] }); client.on("message", function (message) { // inside a command, event listener, etc. const exampleEmbed = new MessageEmbed() .setColor('#0099ff') .setTitle('Some title') .setURL('https://discord.js.org/') .setAuthor('Some name', 'https://i.imgur.com/AfFp7pu.png', 'https://discord.js.org') .setDescription('Some description here') .setThumbnail('https://i.imgur.com/AfFp7pu.png') .addFields( { name: 'Regular field title', value: 'Some value here' }, { name: '\u200B', value: '\u200B' }, { name: 'Inline field title', value: 'Some value here', inline: true }, { name: 'Inline field title', value: 'Some value here', inline: true }, ) .addField('Inline field title', 'Some value here', true) .setImage('https://i.imgur.com/AfFp7pu.png') .setTimestamp() .setFooter('Some footer text here', 'https://i.imgur.com/AfFp7pu.png'); message.channel.send({ embeds: [exampleEmbed] }); return;

Pero está dando el siguiente error:

 DiscordAPIError: Cannot send an empty message at RequestHandler.execute (C:\Users\Federico\node_modules\discord.js\src\rest\RequestHandler.js:154:13) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async RequestHandler.push (C:\Users\Federico\node_modules\discord.js\src\rest\RequestHandler.js:39:14) { method: 'post', path: '/channels/908380877506089000/messages', code: 50006, httpStatus: 400 }

No debería generar errores, es código de la documentación original de Discord.js: https://discordjs.guide/popular-topics/embeds.html , pero lo hace. Estoy ejecutando la última versión de Discord.JS (13.3.1); y Node.js v16.9.0.

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

0

Solucionado: por algunas razones, npm install discord.js en realidad no estaba instalando la versión 13, sino la versión 12. ¡Gracias, @Christoph Blüm!

about 4 years ago · Juan Pablo Isaza Denunciar

0

No sé cómo obtuviste "no se puede enviar un mensaje vacío". Pero en discord.js v13, es messageCreate en lugar de mensaje. Esto funciona para mí (envía la inserción cuando escribes "prueba"):

 client.on("messageCreate", message => { if (message.content === 'test') { const exampleEmbed = new Discord.MessageEmbed() .setColor('#0099ff') .setTitle('Some title') .setURL('https://discord.js.org/') .setAuthor('Some name', 'https://i.imgur.com/AfFp7pu.png', 'https://discord.js.org') .setDescription('Some description here') .setThumbnail('https://i.imgur.com/AfFp7pu.png') .addFields( { name: 'Regular field title', value: 'Some value here' }, { name: '\u200B', value: '\u200B' }, { name: 'Inline field title', value: 'Some value here', inline: true }, { name: 'Inline field title', value: 'Some value here', inline: true }, ) .addField('Inline field title', 'Some value here', true) .setImage('https://i.imgur.com/AfFp7pu.png') .setTimestamp() .setFooter('Some footer text here', 'https://i.imgur.com/AfFp7pu.png'); message.channel.send({ embeds: [exampleEmbed] }); } });
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