【问题标题】:Discord.js send file after embedDiscord.js 嵌入后发送文件
【发布时间】:2022-01-09 16:21:37
【问题描述】:

目前,我的机器人在嵌入之前发送一个文件,但我希望它相反。 这是我的 discord.js v12 代码:

msg.send({embed: {
     "title": "Success",
     "description": `Successfully added ${args[1]}` + "\n Use `m!stock` to see it.",
     "color": "#22ba4a"
   }, files: [free]})

【问题讨论】:

  • 分开通话?发送嵌入,然后跟进文件,有一个回电知道您发送的消息非常直接。

标签: javascript node.js discord discord.js bots


【解决方案1】:

<Message>.send()是一个promise,意味着你可以在你的消息发送后使用.then()函数。例如,您的代码如下所示:

msg.send({
    embed: {
        "title": "Success",
        "description": `Successfully added ${args[1]}\nUse \`m!stock\` to see it.`,
        "color": "#22ba4a"
    },
}).then(() => {
    msg.send({
        files: [free]
    });
});

更多关于Promises

Promise

更多关于.then()

Promise.then()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-17
    • 2020-10-09
    • 2021-08-22
    • 2021-12-12
    • 2017-10-30
    • 2020-11-24
    • 1970-01-01
    • 2022-06-29
    相关资源
    最近更新 更多