我正在让机器人从消息中下载文件,但发生了奇怪的错误const get = require(\'async-get-file \'); if(message.attachments.first()){mess...
我正在让机器人从消息中下载文件,但发生了奇怪的错误
const get = require("async-get-file");
if(message.attachments.first()){
message.channel.send('Uploading...');
var options = {
directory: "pac-man_discordserver/"
// directory: "./images/cats/",
// filename: message.attachments.name
}
await get(message.attachments.first().url,options);
message.channel.send('Successfully uploaded in server!');
return;
}
错误:
node:events:497
throw er; // Unhandled 'error' event
^
Error: ENOENT: no such file or directory, open 'C:\Users\Users\Documents\Yumebot\build\pac-man_discordserver\README.md?ex=66cc0020&is=66caaea0&hm=a9d5d5e0d71399ae983c5e752fa27ae069f300a907816bcfb4b4c6e918ccf108&'
Emitted 'error' event on WriteStream instance at:
at WriteStream.onerror (node:internal/streams/readable:1026:14)
at WriteStream.emit (node:events:519:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\\Users\\Users\\Documents\\Yumebot\\build\\pac-man_discordserver\\README.md?ex=66cc0020&is=66caaea0&hm=a9d5d5e0d71399ae983c5e752fa27ae069f300a907816bcfb4b4c6e918ccf108&'
}
Node.js v20.16.0
默认情况下,如果邮件包含文件,则必须将其下载到目录中,但由于未知原因,它并未这样做