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

424
Visualizações
Passing strings for the URL or the icon's URL for MessageEmbed#setAuthor is deprecated. Pass a sole object instead

I am working on a Discord bot, where if a user enters in a certain command, my bot will reply with an embed.

This is the code for my embed:

let embedInfo = {

    authorName: "My Discord Bot",

    authorLink: "the link for my image",

    thumbnailLink: "the link for the image",

    footer: "Invite us on Discord"
}

let reactivitySeriesInfo = {
    title: "The Reactivity Series of Metals",

    desc: "In chemistry, a reactivity series (or activity series) is an empirical, calculated, and structurally analytical progression of a series of metals, arranged by their \"reactivity\" from highest to lowest.",

    normalImage: "link",

    normalValency: "link",

    anagramValency: "link",

    anagram: "link"
}

module.exports = {
    name: 'chem rs nv',

    description: "To view the normal Reactivity series table, with element valencies.",

    execute(message, args) {

        let embed = new MessageEmbed()

        .setAuthor("My Discord Bot", embedInfo.authorLink)

        .setTitle("The Reactivity Series of Metals")

        .setDescription("In chemistry, a reactivity series (or activity series) is an empirical, calculated, and structurally analytical progression of a series of metals, arranged by their \"reactivity\" from highest to lowest.")

        .setImage(reactivitySeriesInfo.normalValency)

        .setTimestamp()

        .setFooter("Use db!invite to invite us on Discord")

        message.channel.send({embeds: [embed]}).catch(console.error)
    }
}

Note that the "image" is the alias for an image I have uploaded on Imgur. The image links, and the name, are something I don't want to disclose.

Whenever I run my bot script, it shows this error. I know that this error doesn't stop the running script, and this is just an DeprecationWarning. The commands anyways works fine when the command is used.

(node:2416) DeprecationWarning: Passing strings for the URL or the icon's URL for MessageEmbed#setAuthor is deprecated. Pass a sole object instead. (Use `node --trace-deprecation ...` to show where the warning was created)

But I couldn't figure out the meaning of a sole object either in JS or NodeJS. Can someone please explain what is an Sole Object??

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Pass an EmbedAuthorData to setAuthor() to avoid using the deprecated parameters.

let author = {
    name: "My Discord Bot",
    url: "[author url here]",
    iconURL: embedInfo.authorLink
}

let embed = new MessageEmbed()
.setAuthor(author)
...
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