Search code examples
javascriptbotsembeddiscorddiscord.js

Is there a way of making discord embeds better?


I'm developing my own discord bot, my issues are the embeds, are there some trick or modules in node.js that can help me beautify those?

The only thing I had to try were the default embeds, which to be fair I don't like much

else if (message.content.startsWith(`${ prefix }queue`)) {
    if (!serverQueue){
        message.channel.send('Nothing playing');
        message.channel.send({
            embed: {
                color: 13702935,
                description: `**Song Queue**
                ${serverQueue.songs.map(song => `**-**${song.title}`).join("\n")}
                **Now Playing:** ${serverQueue.songs[0].title}
                `
            }
        }
    }
}

Solution

  • var embed = new Discord.RichEmbed()
    .setAuthor('Song Queue',message.guild.iconURL) //<- optional
    .addField(`Song Queue`,`${serverQueue.songs.map(song => `**-**${song.title}`).join("\n")}`,true)
    .addField(`Now Playing`,`${serverQueue.songs[0].title}`,true)
    .setTimestamp()
    .setColor("#hexcode")
    .setFooter(`${message.author.tag}`, message.author.avatarURL)
    message.channel.sendEmbed(embed);