You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Natsuki/handle/event.js

15 lines
671 B

const fs = require('fs');
const moment = require('moment');
const chalk = require('chalk');
module.exports = client => {
let eventFilter = fs.readdirSync('./events/').filter(x => x.endsWith('.js'));
console.log(`\n${chalk.gray('[BOOT]')} >> ${chalk.blue('Getting Events...')}\n`);
for (let file of eventFilter) {
let evt = require('../events/' + file);
let evtName = file.split('.')[0];
client.on(evtName, evt.bind(null, client));
console.log(`${chalk.gray('[LOG] ')} >> ${chalk.blueBright('Loaded Event')} ${chalk.white(evtName)}`);
}
console.log(`\n${chalk.gray('[BOOT]')} >> ${chalk.blue('Loaded all Events')}`);
};