我正在编码一个discord.js机器人,对于我的一个命令,我遇到了这个错误:
错误:EACCES:权限被拒绝,请打开“ /giveaways.json”
这是我的代码:
const fs = require("fs");
const {join} = require('path');
//const Giveaway = require("../structure/giveaway.js");
//const cache = require("../cache.json");
giveaways = require("discord-giveaways");
const giveJson = require("../giveaways.json");
module.exports = class {
constructor(client) {
this.client = client;
}
run() {
try {
this.client.user.setPresence({
game: {
name: "Minecraft Earth",
type: "PLAYING",
},
status: "online",
});
console.log(`${this.client.user.tag} connecté !`);
giveaways.launch(this.client, {
updateCountdownEvery: 5000,
botsCanWin: false,
ignoreIfHasPermission: [],
embedColor: "#1A61BB",
reaction: "?",
storage: "/giveaways.json"
});
/*if (cache.length) cache.forEach(g => new Giveaway(this, null, g.match, g));
this.clearCache();*/
} catch (e) {
console.log(`Error ready.js => ${e.stack}`)
}
/*async clearCache() {
fs.writeFile(join("../cache.json"), "[]", err => {
if (err) throw err;
return null;
});
}*/
}
};
树视图: