discord.js userID avatarURL in embed(discord.js 用户 ID avatarURL 嵌入)
问题描述
我尝试通过用户 ID 显示头像,因为它希望如果我更改它,将显示通过我的用户 ID 在嵌入页脚中加载的新头像.有谁知道v12怎么样?{need without message.author}
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 comming soon");
    embed.setURL(``);
    embed.setDescription("Func description comming soon");
    embed.setImage(``);
    embed.setTimestamp(Date.now());
    embed.setFooter("© 2020 Dominik ~rejzer#9345 | link |", **[USERID .avatarURL or .displayAvatarURL]** ); 
    message.channel.send(embed);
}
推荐答案
我希望你想把你的头像放到嵌入的底部.所以使用以下内容:
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()
其中 bot 是您的客户 (Discord.Client()),guildID 是您所在的公会 ID,userID 是您的 ID(或您要显示其头像的用户).
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).
这篇关于discord.js 用户 ID avatarURL 嵌入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:discord.js 用户 ID avatarURL 嵌入
				
        
 
            
        基础教程推荐
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
 - Node.js 有没有好的索引/搜索引擎? 2022-01-01
 - 如何使用 CSS 显示和隐藏 div? 2022-01-01
 - jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
 - 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
 - 每次设置弹出窗口的焦点 2022-01-01
 - WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
 - 如何在特定日期之前获取消息? 2022-01-01
 - 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
 - 什么是不使用 jQuery 的经验技术原因? 2022-01-01
 
    	
    	
    	
    	
    	
    	
    	
    	
						
						
						
						
						
				
				
				
				