【问题标题】:set embed's image as the authors profile picture Discord.js将 embed 的图片设置为作者个人资料图片 Discord.js
【发布时间】:2020-07-15 01:58:25
【问题描述】:

所以我想问一下,如果有人使用我的嵌入命令,嵌入图像会自动设置为作者的个人资料图片,如果可能的话,我该如何获取。

这是我在命令处理程序中的代码:

const Discord = require('discord.js');
const {
    Client,
    MessageAttachment
} = require('discord.js');

const footer = "Thanks For Reading"
var Version = '1.0';

module.exports = {
    name: 'embeds',
    description: '',
    execute(msg, args) {
        const embed = new Discord.MessageEmbed()
            .setTitle('user information')
            .setColor(0xf1c40f)
            .addField('Username', msg.author.username)
            .addField("server's name", msg.guild.name)
            .addField('Bots Version', Version)
            .setImage("https://static-cdn.jtvnw.net/jtv_user_pictures/988e306e-a4f5-44c0-9685-69cab4a8e7ae-profile_image-70x70.jpg")
            .setFooter("Have fun!")
            .setTimestamp(Date.now())
        msg.reply(embed)
    }
}

谢谢。

【问题讨论】:

    标签: bots discord.js


    【解决方案1】:

    您可以使用.avatarURL() 方法。

    所以你应该是.setImage(msg.author.avatarURL())

    请检查文档,因为您可以使用 .avatarURL() 方法传递选项。

    【讨论】:

      猜你喜欢
      • 2017-09-30
      • 2012-01-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-09
      • 1970-01-01
      • 2013-02-17
      相关资源
      最近更新 更多