javascript - Discord.js Bot embed message isn't showing bot avatar - Stack Overflow

Hi I'm creating my own discord bot and I want to use the mand !botinfoWhen I use that mand it has

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

When I use that mand 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 (mand === `${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

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

When I use that mand 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 (mand === `${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

Share Improve this question edited Apr 8, 2020 at 1:22 B. Go 1,4244 gold badges17 silver badges23 bronze badges asked Apr 6, 2020 at 18:37 Kevin VerdoodtKevin Verdoodt 511 silver badge9 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

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();

I found the solution

if (mand === `${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);
    }```


发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744251748a4565201.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信