【问题标题】:How to your Discord account creation and add it to an embed?如何创建 Discord 帐户并将其添加到嵌入中?
【发布时间】:2020-11-05 06:49:17
【问题描述】:

我想知道如何创建 Discord 帐户。我也想知道如何将其放入嵌入中。是的,我确实知道如何制作嵌入,但如何插入。

【问题讨论】:

  • 第一个问题是什么意思?!

标签: discord discord.js


【解决方案1】:

Discord account creation,我假设您指的是 User#createdAt 属性 - 它返回一个包含用户帐户创建时间的 Date 对象。

注意 1. 您可以通过调用 Date.toUTCString() 或类似方法(参见 here)将 Date 对象转换为漂亮的时间字符串

将它添加到嵌入对我来说似乎很简单。

到那时,您的代码应该如下所示:

const user = getSomeUserHere() //for example, you can do message.author to get the User object of the message's author
const createdDate = user.createdAt

const embed = new Discord.MessageEmbed()
.setTitle("This user was created at")
.setDescription(`${createdDate.toUTCString()}`);

message.channel.send(embed) //or however you plan to send this embed

【讨论】:

    猜你喜欢
    • 2020-09-20
    • 2021-08-13
    • 1970-01-01
    • 2020-11-22
    • 2018-06-02
    • 2020-07-16
    • 2012-05-02
    • 1970-01-01
    • 2022-06-12
    相关资源
    最近更新 更多