目前,我的机器人在嵌入之前发送一个文件,但我希望它以相反的方式发送。 这是我的 discord.js v12 代码:
msg.send({embed: {
"title": "Success",
"description": `Successfully added ${args[1]}` + "\n Use `m!stock` to see it.",
"color": "#22ba4a"
}, files: [free]})
最佳答案
<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
更多关于 .then()
关于javascript - Discord.js 嵌入后发送文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70643255/