Discord.js send file after embed

Viewed 485

Currently, my bot sends a file before the embed, but I want it the opposite way. This is my discord.js v12 code:

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

Current

1 Answers

<Message>.send() is a promise, meaning that you can use .then() functions after your message is sent. For example, your code would look something like this:

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

More on Promises

Promise

More on .then()

Promise.then()

Related