简体   繁体   中英

How can i send a file attachment in discord.js v14

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

For your example:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM