module.exports = client => { client.loadCommand = (commandName) => { try { const props = require(`../commands/${commandName}`) if (props.init) { props.init(client) } client.commands.set(props.help.name, props) props.conf.aliases.forEach(alias => { client.aliases.set(alias, props.help.name) }) return false } catch (e) { return `Failed to load ${commandName}: ${e}` } } process.on('uncaughtException', (err) => { const errorMsg = err.stack.replace(new RegExp(`${__dirname}/`, 'g'), './') client.logger.fatal(`Uncaught Exception: ${errorMsg}`) process.exit(1) }) process.on('unhandledRejection', err => { client.logger.error(`Unhandled rejection: ${err}`) }) }