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

309
Vistas
MessageEmbed author name must be a string

I've tried to create an embed message on Discord base on this discordjs.guide, and ran into this problem:

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'
}

Here's my code:

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]
        });
    },
};

I just don't understand, the key "name" here has a string value: 'some name', so why can't it run? My temporary solution here is to wipe out that Author part and the code runs smooth as heck.

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

0

I had the same issue - what fixed it for me was removing the {} inside of .setAuthor() as well as omitting name:, iconURL:, and url:.

So, it would look like this:

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

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