Javascript 如何使用discord.js获取特定的成员用户名
我想在嵌入消息中添加一个特定的成员信息用户名+化身。有人知道怎么做吗Javascript 如何使用discord.js获取特定的成员用户名,javascript,node.js,discord.js,Javascript,Node.js,Discord.js,我想在嵌入消息中添加一个特定的成员信息用户名+化身。有人知道怎么做吗 const feedback = new discord.RichEmbed() .setColor([0, 0, 255]) .setFooter("Bot created by : " + message.author.username, message.author.avatarURL) .setDescription("The text I want to be sent") 在上面的代码中,我想通过特定的disco
const feedback = new discord.RichEmbed()
.setColor([0, 0, 255])
.setFooter("Bot created by : " + message.author.username, message.author.avatarURL)
.setDescription("The text I want to be sent")
在上面的代码中,我想通过特定的discord成员标识id(例如:436577130583949315)更改message.author.username和message.author.avatarUrl
然而,我不知道如何从这个不和谐的身份号码中显示用户名和化身
提前感谢您的帮助:由于管理器的实施,必须修改以下代码,以便在编辑时使用最新版本的Discord.js v12
您可以通过用户ID从客户端的用户缓存中检索用户。但是,并不能保证所有用户都会被缓存,所以您可以使用从Discord中获取用户。请记住,它返回一个。如果用户在缓存中,该方法将返回它
例如:
//“等待”所需的异步上下文
试一试{
const devID='436577130583949315';
const dev=await client.fetchUserdevID;
const feedback=new discord.RichEmbed
.setColor[0,0,255]
.setFooter`Bot由${dev.tag}创建。`,dev.displayAvatarURL
.setDescription“此处为您的文本”;
等待message.channel.sendfeedback;
}捕手{
console.error;
}
非常感谢你