diff --git a/structure/client/Logger.js b/structure/client/Logger.js new file mode 100644 index 0000000..0c67f41 --- /dev/null +++ b/structure/client/Logger.js @@ -0,0 +1,62 @@ +const chalk = require('chalk'); + +class Logger { + + constructor(client) { + + this.client = client; + + this.client.hooker.hook('ready', () => { + this.transport(`Client connected to ${chalk.bold(this.client.user.tag)} with ${chalk.bold(`${this.client.guilds.size} guild${this.client.guilds.size === 1 ? '' : 's'}`)}.`, { embed: true, type: 'SUCCESS' }); + }); + + this.client.hooker.hook('componentUpdate', ({ component, type }) => { + this.info(`Component ${chalk.bold(component.resolveable)} was ${chalk.bold(Constants.ComponentTypes[type])}.`); + }); + + this.client.hooker.hook('reconnect', () => { + this.warn(`Shard is reconnecting.`, { embed: true }); + }); + + } + + async transport(message = 'N/A', opts = {}) { + process.send({ message, ...opts }); + } + + /* Quick & Dirty Functions */ + + log(message, opts = {}) { + this.transport(message, { ...opts, type: 'LOG' }); + } + + info(message, opts = {}) { + this.transport(message, { ...opts, type: 'INFO' }); + } + + warn(message, opts = {}) { + this.transport(message, { ...opts, type: 'WARN' }); + } + + debug(message, opts = {}) { + this.transport(message, { ...opts, type: 'DEBUG' }); + } + + error(message, opts = {}) { + this.transport(message, { ...opts, type: 'ERROR' }); + } + + +} + +module.exports = Logger; + +const Constants = { + ComponentTypes: { + LOAD: 'loaded', + UNLOAD: 'unloaded', + RELOAD: 'reloaded', + ENABLE: 'enabled', + DISABLE: 'disabled' + } +}; \ No newline at end of file diff --git a/structure/client/Transporter.js b/structure/client/Transporter.js deleted file mode 100644 index 0e3b656..0000000 --- a/structure/client/Transporter.js +++ /dev/null @@ -1,12 +0,0 @@ -class Transporter { - - constructor(manager) { - - this.manager = manager; - - } - - -} - -module.exports = Transporter; \ No newline at end of file