Harique
Harique

Reputation: 23

set embed's image as the authors profile picture Discord.js

So I wanted to ask how do I get if someone uses my embed command the embed image automatically sets as the author's profile picture if that's possible.

Heres my code inside a command handler:

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)
    }
}

Thank you.

Upvotes: 1

Views: 5605

Answers (1)

Syntle
Syntle

Reputation: 5174

You can use the .avatarURL() method.

So for you it'd be .setImage(msg.author.avatarURL())

Please check the documentation though since you can pass options using .avatarURL() method.

Upvotes: 2

Related Questions