From 1d7707221d60aa37241acccca6862a17845d74c6 Mon Sep 17 00:00:00 2001 From: nolan Date: Sun, 19 Jul 2020 18:25:27 -0700 Subject: [PATCH] logging for guild add/leave and command execution --- structure/client/Logger.js | 12 ++++++++++++ structure/extensions/Message.js | 2 ++ structure/moderation/infractions/index.js | 4 ++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/structure/client/Logger.js b/structure/client/Logger.js index c16d1d9..2d4cd33 100644 --- a/structure/client/Logger.js +++ b/structure/client/Logger.js @@ -19,6 +19,18 @@ class Logger { this.warn(`Shard is reconnecting.`); }); + this.client.eventHooker.hook('guildCreate', (guild) => { + this.debug(`${chalk.bold('[GUILD]')} Joined guild ${chalk.bold(guild.name)} (${guild.id}).`); + }); + + this.client.eventHooker.hook('guildDelete', (guild) => { + this.debug(`${chalk.bold('[GUILD]')} Left guild ${chalk.bold(guild.name)} (${guild.id}).`); + }); + + this.client.eventHooker.hook('commandExecute', (message) => { + this.debug(`${chalk.bold('[EXECU]')} ${message.author.tag} (${message.author.id}) executed command ${chalk.bold(message.command.moduleResolveable)}.`); + }); + } async transport(message = 'N/A', opts = {}) { diff --git a/structure/extensions/Message.js b/structure/extensions/Message.js index 65e05a4..22dee53 100644 --- a/structure/extensions/Message.js +++ b/structure/extensions/Message.js @@ -63,6 +63,8 @@ const Message = Structures.extend('Message', (Message) => { return this._showUsage(); } + this.client.emit('commandExecute', this); + try { const resolved = this.command.execute(this, { params: this.parameters, diff --git a/structure/moderation/infractions/index.js b/structure/moderation/infractions/index.js index 36b1d71..38f7a60 100644 --- a/structure/moderation/infractions/index.js +++ b/structure/moderation/infractions/index.js @@ -11,6 +11,6 @@ module.exports = { Vckick: require('./Vckick.js'), Slowmode: require('./Slowmode.js'), Nickname: require('./Nickname.js'), - AddRole: require('./AddRole.js'), - RemoveRole: require('./RemoveRole.js') + AddRole: require('./Addrole.js'), + RemoveRole: require('./Removerole.js') }; \ No newline at end of file