logging for guild add/leave and command execution

This commit is contained in:
nolan 2020-07-19 18:25:27 -07:00
parent 4c269f9e7a
commit 1d7707221d
3 changed files with 16 additions and 2 deletions

View File

@ -19,6 +19,18 @@ class Logger {
this.warn(`Shard is reconnecting.`); 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 = {}) { async transport(message = 'N/A', opts = {}) {

View File

@ -63,6 +63,8 @@ const Message = Structures.extend('Message', (Message) => {
return this._showUsage(); return this._showUsage();
} }
this.client.emit('commandExecute', this);
try { try {
const resolved = this.command.execute(this, { const resolved = this.command.execute(this, {
params: this.parameters, params: this.parameters,

View File

@ -11,6 +11,6 @@ module.exports = {
Vckick: require('./Vckick.js'), Vckick: require('./Vckick.js'),
Slowmode: require('./Slowmode.js'), Slowmode: require('./Slowmode.js'),
Nickname: require('./Nickname.js'), Nickname: require('./Nickname.js'),
AddRole: require('./AddRole.js'), AddRole: require('./Addrole.js'),
RemoveRole: require('./RemoveRole.js') RemoveRole: require('./Removerole.js')
}; };