简体   繁体   English

Discord.JS 嵌入:页脚中的用户头像

[英]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.我正在尝试将我朋友为 Discord 机器人制作的一些 PHP 代码移植到 DiscordJS。 Here's what he wrote for an embed (in PHP):这是他为嵌入(在 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.我在尝试移植将用户头像添加到页脚的部分时遇到问题,我无法弄清楚“AV”是什么以及它如何将图像添加到文本的开头。

AV is the second paramter given to $embed->setFooter) AV 是赋予$embed->setFooter)

[TAKEN FROM DOCS] [取自文档]

In discord.js, there are also two paramaters text: StringResolvable and iconURL: string .在 discord.js 中,还有两个参数text: StringResolvableiconURL: string iconURL is an optional paramater. iconURL是一个可选参数。

To port $embed->setFooter($message->author->username, $av = $message->user->avatar);移植$embed->setFooter($message->author->username, $av = $message->user->avatar); just add只需添加

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM