Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

307
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda