0
votes

Hi I'm creating my own discord bot and I want to use the command !botinfo

When I use that command it has to show a embed message in my channel. So far everything works expect it doesn't show my Discord bot his avatar. Can anyone help me out?

if (command === `${prefix}botinfo`) {

    var botIcon = new bot.user.displayAvatarURL;

    var botEmbed = new discord.MessageEmbed()
        .setDescription("Discord bot info")
        .setColor(0xF1C40F)
        .setThumbnail(botIcon)
        .addField("Bot name", bot.user.username);

return message.channel.send(botEmbed);

The error I get is -> bot.user.displayAvatarURL is not a constructor

2

2 Answers

3
votes

Do not use the new keyword when accessing methods (or properties). You only use that to create new object instances.

var botIcon = bot.user.displayAvatarURL();
2
votes

I found the solution

if (command === `${prefix}botinfo`) {


        var botEmbed = new discord.MessageEmbed()
            .setDescription("Bot Info")
            .setColor(0xF1C40F)
            .setThumbnail(bot.user.displayAvatarURL())
            .addField("Bot name", bot.user.username, true)
            .addField("Version", version, true)
            .addField("Creator", creator)

            return message.channel.send(botEmbed);
    }```