javascript - discord.js userID avatarURL in embed - Stack Overflow

I trying display avatar via userID because it wants that if I changed it, the new one loaded via my use

I trying display avatar via userID because it wants that if I changed it, the new one loaded via my user ID in footer in embed will be displayed. Anyone know how on v12? {need without message.author}

else if(isValidCommand(message, "embed")) {
    let embedContent = message.content.substring(9);
    let embed = new discord.MessageEmbed();
    embed.addField('Message: ', embedContent);
    embed.setColor('PURPLE');
    embed.setAuthor(message.author.tag, message.author.avatarURL());
    embed.setThumbnail( client.user.avatarURL());
    embed.setTitle("Func title ming soon");
    embed.setURL(``);
    embed.setDescription("Func description ming soon");
    embed.setImage(``);
    embed.setTimestamp(Date.now());
    embed.setFooter("© 2020 Dominik ~rejzer#9345 | link |", **[USERID .avatarURL or .displayAvatarURL]** ); 
    message.channel.send(embed);
}

I trying display avatar via userID because it wants that if I changed it, the new one loaded via my user ID in footer in embed will be displayed. Anyone know how on v12? {need without message.author}

else if(isValidCommand(message, "embed")) {
    let embedContent = message.content.substring(9);
    let embed = new discord.MessageEmbed();
    embed.addField('Message: ', embedContent);
    embed.setColor('PURPLE');
    embed.setAuthor(message.author.tag, message.author.avatarURL());
    embed.setThumbnail( client.user.avatarURL());
    embed.setTitle("Func title ming soon");
    embed.setURL(``);
    embed.setDescription("Func description ming soon");
    embed.setImage(``);
    embed.setTimestamp(Date.now());
    embed.setFooter("© 2020 Dominik ~rejzer#9345 | link |", **[USERID .avatarURL or .displayAvatarURL]** ); 
    message.channel.send(embed);
}
Share Improve this question edited Apr 14, 2020 at 6:35 Evaldas Buinauskas 14.1k11 gold badges61 silver badges118 bronze badges asked Apr 14, 2020 at 6:32 rejzerrejzer 131 gold badge1 silver badge3 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

I hope you want to get your profile picture to the bottom of the embed. So use following:

 bot.guilds.resolve(guildID).members.resolve(userID).user.avatarURL()

where bot is your client (Discord.Client()), guildID is id of guild you're in and userID is your Id (or user you want to display profile picture of).

If the other solution doesn't work for you (unfortunately it didn't for me) you can try mine.

const client = new Discord.Client();
let thanos = client.users.fetch('IDHERE');
thanos.then(function(result1) {
    var imgURL = result1.displayAvatarURL();
});

And then you can use the URL in your embed.

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

相关推荐

  • javascript - discord.js userID avatarURL in embed - Stack Overflow

    I trying display avatar via userID because it wants that if I changed it, the new one loaded via my use

    8天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

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

关注微信