Added things
This commit is contained in:
6
index.js
6
index.js
@@ -1,12 +1,18 @@
|
||||
const Eris = require('eris');
|
||||
const configM = require('./src/configManager');
|
||||
const logger = require('./src/logger');
|
||||
const commandL = require('./src/commandLoader');
|
||||
|
||||
// TODO: botClient.js
|
||||
|
||||
if (!configM.loadConfig('./config.json')) {
|
||||
logger.error('No config file has been found in the directory, please configure the template that has been created.');
|
||||
}
|
||||
logger.log('Config loaded');
|
||||
|
||||
commandL.load();
|
||||
logger.log('Commands loaded');
|
||||
|
||||
var bot = new Eris(configM.config.token);
|
||||
bot.on('ready', () => {
|
||||
logger.log(bot.user.username + '#' + bot.user.discriminator);
|
||||
|
||||
4
src/cmd/debug.js
Normal file
4
src/cmd/debug.js
Normal file
@@ -0,0 +1,4 @@
|
||||
exports.loadModule = function loadModule (commandH) {
|
||||
console.log('In debug.js');
|
||||
console.log(commandH);
|
||||
}
|
||||
@@ -1,4 +1,15 @@
|
||||
const fs = require('fs');
|
||||
const commandH = require('./commandHandler');
|
||||
const logger = require('./logger');
|
||||
|
||||
fs.readdirSync();
|
||||
module.exports.load = function load() {
|
||||
fs.readdirSync('./src/cmd/').forEach(file => {
|
||||
if (file.endsWith('.js')) {
|
||||
let plugin = require(`./cmd/${file}`);
|
||||
if (plugin.loadModule) {
|
||||
plugin.loadModule(commandH);
|
||||
logger.log(`${file} loaded`);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user