简体   繁体   English

我如何在 discord.js v14 中发送文件附件

[英]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);
});;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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