Estoy trabajando en un bot de Discord, donde si un usuario ingresa un determinado comando, mi bot responderá con un incrustado .
Este es el código para mi inserción:
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) } }Tenga en cuenta que la "imagen" es el alias de una imagen que he subido a Imgur. Los enlaces de imágenes y el nombre son algo que no quiero revelar.
Cada vez que ejecuto mi script de bot, muestra este error. Sé que este error no detiene la secuencia de comandos en ejecución, y esto es solo una DeprecationWarning . De todos modos, los comandos funcionan bien cuando se usa el comando.
(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)Pero no pude entender el significado de un único objeto ni en JS ni en NodeJS. ¿Alguien puede explicar qué es un objeto único?
Pase un EmbedAuthorData a setAuthor() para evitar el uso de parámetros obsoletos.
let author = { name: "My Discord Bot", url: "[author url here]", iconURL: embedInfo.authorLink } let embed = new MessageEmbed() .setAuthor(author) ...