Home > Software engineering >  How can i send a file attachment in discord.js v14
How can i send a file attachment in discord.js v14

Time:12-19

I want to be able to let the user send a file, then i will do stuff with the text and send a message with the changed text as an attachment.

I got the text using this

request(url, {json: false}, (err, res, body) => {
    if (err) {return msg.reply("There was an error getting the file")}
})

but I do not know how I can send a file attachment

CodePudding user response:

For your example:

await msg.reply({
    content:
        `Text`,
    files: ["path to file"]
}).catch((err) => {
     console.log("Error during Export File "   err);
});;
  • Related