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

306
Views
El nombre del autor de MessageEmbed debe ser una cadena

Intenté crear un mensaje incrustado en Discord basado en este discordjs.guide y me encontré con este problema:

 RangeError [EMBED_AUTHOR_NAME]: MessageEmbed author name must be a string. at Function.verifyString (D:\Kien Thuc\IT\HTML CSS JAVASCRIPT\DiscordBot\node_modules\discord.js\src\util\Util.js:413:41) at MessageEmbed.setAuthor (D:\Kien Thuc\IT\HTML CSS JAVASCRIPT\DiscordBot\node_modules\discord.js\src\structures\MessageEmbed.js:356:32) at Object.execute (D:\Kien Thuc\IT\HTML CSS JAVASCRIPT\DiscordBot\commands\example-embed.js:16:14) at Client.<anonymous> (D:\Kien Thuc\IT\HTML CSS JAVASCRIPT\DiscordBot\index.js:24:17) at Client.emit (node:events:390:28) at InteractionCreateAction.handle (D:\Kien Thuc\IT\HTML CSS JAVASCRIPT\DiscordBot\node_modules\discord.js\src\client\actions\InteractionCreate.js:70:12) bsocket\WebSocketShard.js:443:22) at WebSocketShard.onMessage (D:\Kien Thuc\IT\HTML CSS JAVASCRIPT\DiscordBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:300:10) { [Symbol(code)]: 'EMBED_AUTHOR_NAME' }

Aquí está mi código:

 const { SlashCommandBuilder } = require('@discordjs/builders'); const { MessageEmbed } = require('discord.js'); module.exports = { data: new SlashCommandBuilder() .setName('embeds') .setDescription('embeds'), async execute(interaction) { const exampleEmbed = new MessageEmbed() .setColor('#0099ff') .setTitle('Some title') .setURL('https://discord.js.org/') .setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: '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'); await interaction.reply({ embeds: [exampleEmbed] }); }, };

Simplemente no entiendo, la clave "nombre" aquí tiene un valor de cadena: 'algún nombre', entonces, ¿por qué no se puede ejecutar? Mi solución temporal aquí es eliminar esa parte del autor y el código funciona sin problemas.

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

0

Tuve el mismo problema: lo que me solucionó fue eliminar el {} dentro de .setAuthor() y omitir name: , iconURL: y url: .

Entonces, se vería así:

.setAuthor('Some name','https://i.imgur.com/AfFp7pu.png','https://discord.js.org')

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!