diff --git a/src/Client.ts b/src/Client.ts index 70e0095..7bd7c7f 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -1,6 +1,6 @@ import Discord, { Client, Collection } from "discord.js"; import fs from "fs"; -import Datastore from "./client/datastore.js"; +import Datastore from "./client/classes/Datastore.js"; import { command, radio } from "./client/utils/typings.js"; import config from "./config.js"; import messages from "./client/messages.js"; diff --git a/src/client/datastore.js b/src/client/classes/Datastore.js similarity index 92% rename from src/client/datastore.js rename to src/client/classes/Datastore.js index 4db0eee..89c2751 100644 --- a/src/client/datastore.js +++ b/src/client/classes/Datastore.js @@ -8,15 +8,15 @@ module.exports = class { } loadData() { - const dir = path.join(path.dirname(__dirname), '../datastore'); + const dir = path.join(path.dirname(__dirname), '../../datastore'); if (!fs.existsSync(dir)) { fs.mkdirSync(dir); } //console.log(""); - const dataFiles = fs.readdirSync(path.join(path.dirname(__dirname), '../datastore')).filter(f => f.endsWith('.json')); + const dataFiles = fs.readdirSync(path.join(path.dirname(__dirname), '../../datastore')).filter(f => f.endsWith('.json')); for (const file of dataFiles) { try { - const json = require(`../../datastore/${file}`); + const json = require(`../../../datastore/${file}`); this.map.set(json.guild.id, json); //console.log('[LOADED] ' + file + " (" + json.guild.id + ")"); //console.log(JSON.stringify(json, null, 4)); @@ -127,7 +127,7 @@ module.exports = class { saveEntry(file, data) { data = JSON.stringify(data, null, 4); - fs.writeFile(path.join(path.dirname(__dirname), '../datastore') + "/" + file + ".json", data, 'utf8', function(err) { + fs.writeFile(path.join(path.dirname(__dirname), '../../datastore') + "/" + file + ".json", data, 'utf8', function(err) { if (err) { //console.log(err); }