Search code examples
javascriptembeddiscorddiscord.jsavatar

Little image in embed titles, Discord.js


I've been trying to display little images in my embeds titles. But I can't make it work, the whole URL is displayed.
Code I tried to use:

    var embed = new Discord.RichEmbed()
        .setTitle(message.author.displayAvatar)
        //I tried displayAvatarURL too
        .setDescription('Test');
        channel.send(embed);

Solution

  • That icon is from embed.setAuthor.

    var embed = new Discord.RichEmbed()
        .setTitle("My Title")
        .setAuthor("My Name", message.author.avatarURL)
        .setDescription("My Description");
        channel.send(embed);
    

    And also to get the URL from the user avatar, on the current Discord.js version is message.author.avatarURL and not displayAvatar.