From a231be5f43b5486b278cbdc596ed0b74a6f3ca91 Mon Sep 17 00:00:00 2001 From: mudkipscience Date: Mon, 9 Mar 2020 12:43:21 +1100 Subject: [PATCH] Moved inde.x.js out of src Caused way too many issues --- src/index.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/index.js b/src/index.js index 61b1610..9b559ff 100644 --- a/src/index.js +++ b/src/index.js @@ -6,28 +6,26 @@ const chalk = require('chalk'); const DBL = require("dblapi.js"); const client = new Discord.Client(); -client.config = require('../config'); -client.version = require('../version.json'); -client.logger = require('./modules/Logger'); -require("./modules/functions")(client); +client.config = require('./config'); +client.version = require('./version.json'); +client.logger = require('./src/modules/Logger'); +require("./src/modules/functions")(client); client.logger.setClient(client); if(process.env['USER'] != 'container') { client.devmode = true; - client.settings = new Enmap({name: 'settings', dataDir: '../data'}); - client.blacklist = new Enmap({name: 'blacklist', dataDir: '../data'}); } else { client.devmode = false; const dblapi = new DBL(client.config.dblkey, client); - client.settings = new Enmap({name: 'settings'}); - client.blacklist = new Enmap({name: 'blacklist'}); } client.commands = new Enmap(); client.aliases = new Enmap(); +client.settings = new Enmap({name: 'settings'}); +client.blacklist = new Enmap({name: 'blacklist'}); const init = async () => { - const cmdFiles = await readdir("./commands/"); + const cmdFiles = await readdir("./src/commands/"); client.logger.info(`Loading ${cmdFiles.length} commands.`); cmdFiles.forEach(file => { if (!file.endsWith(".js")) { @@ -39,14 +37,14 @@ const init = async () => { }; }); - const evtFiles = await readdir("./events/"); + const evtFiles = await readdir("./src/events/"); client.logger.info(`Loading ${evtFiles.length} events.`); evtFiles.forEach(file => { if (!file.endsWith(".js")) { return; }; const eventName = file.split(".")[0]; - const event = require(`./events/${file}`); + const event = require(`./src/events/${file}`); client.on(eventName, event.bind(null, client)); });