【问题标题】:discord.js userID avatarURL in embeddiscord.js 用户 ID avatarURL 嵌入
【发布时间】:2020-07-26 20:07:52
【问题描述】:

我尝试通过 userID 显示头像,因为它希望如果我更改它,将显示通过我的用户 ID 在嵌入页脚中加载的新头像。有谁知道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);
}

【问题讨论】:

    标签: javascript discord discord.js avatar


    【解决方案1】:

    我希望您希望将您的个人资料图片放在嵌入的底部。 所以使用以下内容:

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

    bot 是您的客户 (Discord.Client()),guildID 是您所在的公会 ID,userID 是您的 ID(或您要显示其头像的用户)。

    【讨论】:

    • +1 谢谢老兄
    【解决方案2】:

    如果其他解决方案不适合您(不幸的是它不适合我),您可以试试我的。

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

    然后您可以在嵌入中使用该 URL。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-08
      • 2021-11-01
      • 2021-08-01
      • 2021-02-07
      • 2021-03-23
      • 2020-12-16
      • 2021-05-01
      • 2019-07-15
      相关资源
      最近更新 更多