Search code examples
javascriptphpdiscord.jsembed

Discord.JS embed: User avatar in footer


I'm trying to port over some PHP code my friend made for a Discord bot, to DiscordJS. Here's what he wrote for an embed (in PHP):

$embed->setFooter($message->author->username, $av = $message->user->avatar);

I'm having trouble trying to port over the part that adds the user avatar to the footer, I can't figure out what 'AV' is and how it adds the image to the start of the text.


Solution

  • AV is the second paramter given to $embed->setFooter)

    [TAKEN FROM DOCS]

    In discord.js, there are also two paramaters text: StringResolvable and iconURL: string. iconURL is an optional paramater.

    To port $embed->setFooter($message->author->username, $av = $message->user->avatar); just add

    embed.setFooter(message.author.username, message.user.displayAvatarURL());