【问题标题】:Little image in embed titles, Discord.js嵌入标题中的小图像,Discord.js
【发布时间】:2018-10-15 22:01:19
【问题描述】:

我一直在尝试在我的嵌入标题中显示小图像。但我无法让它工作,整个 URL 都显示出来了。
我尝试使用的代码:

    var embed = new Discord.RichEmbed()
        .setTitle(message.author.displayAvatar)
        //I tried displayAvatarURL too
        .setDescription('Test');
        channel.send(embed);

【问题讨论】:

    标签: javascript embed discord discord.js avatar


    【解决方案1】:

    那个图标来自embed.setAuthor

    var embed = new Discord.RichEmbed()
        .setTitle("My Title")
        .setAuthor("My Name", message.author.avatarURL)
        .setDescription("My Description");
        channel.send(embed);
    

    还要从用户头像获取 URL,在当前 Discord.js 版本上是 message.author.avatarURL 而不是 displayAvatar

    【讨论】:

      【解决方案2】:

      如果你想添加一点小图片,你需要defaultAvatarUR

          var embed = new Discord.RichEmbed()
              .setAuthor(message.author.defaultAvatarUR)
              .setDescription('Test');
              channel.send(embed);
      

      会是这样的 click here to see

      【讨论】:

        猜你喜欢
        • 2021-09-06
        • 2020-08-10
        • 1970-01-01
        • 2022-01-21
        • 2020-03-15
        • 2023-03-29
        • 2020-10-18
        • 2020-12-05
        • 2018-07-08
        相关资源
        最近更新 更多