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
2 Answers
Reset to default 4Do 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条)