Moved inde.x.js out of src

Caused way too many issues
This commit is contained in:
Emily 2020-03-09 12:43:21 +11:00
parent accc889ff3
commit a231be5f43

View file

@ -6,28 +6,26 @@ const chalk = require('chalk');
const DBL = require("dblapi.js"); const DBL = require("dblapi.js");
const client = new Discord.Client(); const client = new Discord.Client();
client.config = require('../config'); client.config = require('./config');
client.version = require('../version.json'); client.version = require('./version.json');
client.logger = require('./modules/Logger'); client.logger = require('./src/modules/Logger');
require("./modules/functions")(client); require("./src/modules/functions")(client);
client.logger.setClient(client); client.logger.setClient(client);
if(process.env['USER'] != 'container') { if(process.env['USER'] != 'container') {
client.devmode = true; client.devmode = true;
client.settings = new Enmap({name: 'settings', dataDir: '../data'});
client.blacklist = new Enmap({name: 'blacklist', dataDir: '../data'});
} else { } else {
client.devmode = false; client.devmode = false;
const dblapi = new DBL(client.config.dblkey, client); 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.commands = new Enmap();
client.aliases = new Enmap(); client.aliases = new Enmap();
client.settings = new Enmap({name: 'settings'});
client.blacklist = new Enmap({name: 'blacklist'});
const init = async () => { const init = async () => {
const cmdFiles = await readdir("./commands/"); const cmdFiles = await readdir("./src/commands/");
client.logger.info(`Loading ${cmdFiles.length} commands.`); client.logger.info(`Loading ${cmdFiles.length} commands.`);
cmdFiles.forEach(file => { cmdFiles.forEach(file => {
if (!file.endsWith(".js")) { 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.`); client.logger.info(`Loading ${evtFiles.length} events.`);
evtFiles.forEach(file => { evtFiles.forEach(file => {
if (!file.endsWith(".js")) { if (!file.endsWith(".js")) {
return; return;
}; };
const eventName = file.split(".")[0]; const eventName = file.split(".")[0];
const event = require(`./events/${file}`); const event = require(`./src/events/${file}`);
client.on(eventName, event.bind(null, client)); client.on(eventName, event.bind(null, client));
}); });