admin管理员组文章数量:1401673
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
2 Answers
Reset to default 3I 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.
本文标签: javascriptdiscordjs userID avatarURL in embedStack Overflow
版权声明:本文标题:javascript - discord.js userID avatarURL in embed - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744250170a2597214.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论