From 0d50e925e61e421f14f4efcb1ed758ecdd57582c Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Sat, 26 Mar 2022 22:16:23 +0200 Subject: [PATCH] misc --- .../components/commands/moderation/MuteCommand.js | 2 +- src/structure/components/observers/AuditLog.js | 11 ++++------- src/structure/components/observers/CommandHandler.js | 10 +++------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/structure/components/commands/moderation/MuteCommand.js b/src/structure/components/commands/moderation/MuteCommand.js index a96d615..e5c9fc4 100644 --- a/src/structure/components/commands/moderation/MuteCommand.js +++ b/src/structure/components/commands/moderation/MuteCommand.js @@ -35,7 +35,7 @@ class MuteCommand extends SlashCommand { async execute(thing, options) { - fruck; + //fruck; console.log(options); diff --git a/src/structure/components/observers/AuditLog.js b/src/structure/components/observers/AuditLog.js index 5ad7e5e..901efed 100644 --- a/src/structure/components/observers/AuditLog.js +++ b/src/structure/components/observers/AuditLog.js @@ -22,8 +22,7 @@ class AuditLogObserver extends Observer { } - async guildBanAdd({ guild, user }) { - const wrapper = new GuildWrapper(this.client, guild); + async guildBanAdd({ guild, user, guildWrapper: wrapper }) { const settings = await wrapper.settings(); if (!settings.moderation.channel || !settings.moderation.infractions.includes('BAN')) return undefined; //This is checked by the infraction handling, but it may save resources if checked earlier. const audit = await this._fetchFirstEntry(guild, user, 'MEMBER_BAN_ADD'); @@ -38,8 +37,7 @@ class AuditLogObserver extends Observer { }).handle(); } - async guildBanRemove({ guild, user }) { - const wrapper = new GuildWrapper(this.client, guild); + async guildBanRemove({ guild, user, guildWrapper: wrapper }) { const settings = await wrapper.settings(); if (!settings.moderation.channel || !settings.moderation.infractions.includes('UNBAN')) return undefined; //This is checked by the infraction handling, but it may save resources if checked earlier. const audit = await this._fetchFirstEntry(guild, user, 'MEMBER_BAN_REMOVE'); @@ -55,7 +53,7 @@ class AuditLogObserver extends Observer { } async guildMemberRemove(member) { - const wrapper = new GuildWrapper(this.client, member.guild); + const { guildWrapper: wrapper } = member; const settings = await wrapper.settings(); if (!settings.moderation.channel || !settings.moderation.infractions.includes('KICK')) return undefined; //This is checked by the infraction handling, but it may save resources if checked earlier. const audit = await this._fetchFirstEntry(member.guild, member.user, 'MEMBER_KICK'); @@ -72,8 +70,7 @@ class AuditLogObserver extends Observer { async guildMemberUpdate(oldMember, newMember) { if (oldMember.roles.cache.size === newMember.roles.cache.size) return undefined; - const { guild } = newMember; - const wrapper = new GuildWrapper(this.client, guild); + const { guildWrapper: wrapper } = newMember; const settings = await wrapper.settings(); if (!settings.moderation.channel) return undefined; diff --git a/src/structure/components/observers/CommandHandler.js b/src/structure/components/observers/CommandHandler.js index d6fb4a1..1838346 100644 --- a/src/structure/components/observers/CommandHandler.js +++ b/src/structure/components/observers/CommandHandler.js @@ -45,10 +45,6 @@ class CommandHandler extends Observer { || interaction.guild && !interaction.guild.available) return undefined; const command = this._matchCommand(interaction.commandName); - - // let guildWrapper = null; - // if(interaction.guild) guildWrapper = new GuildWrapper(this.client, interaction.guild); - // const wrapper = new InteractionWrapper(this.client, interaction, guildWrapper); interaction.command = command; if (!command) return interaction.reply({ @@ -70,7 +66,7 @@ class CommandHandler extends Observer { }); } - this.client.logger.info(`${interaction.user.tag} (${interaction.user.id}) is executing ${command.name}`); + this.logger.info(`${interaction.user.tag} (${interaction.user.id}) is executing ${command.name}`); await this._executeCommand(interaction, response.options); } @@ -80,7 +76,7 @@ class CommandHandler extends Observer { try { await thing.command.execute(thing, options); } catch(error) { - this.client.logger.error(error.stack || error); + this.logger.error(error.stack || error); this._generateError(thing); } @@ -108,7 +104,7 @@ class CommandHandler extends Observer { const matched = _subcommand.options.find((o) => o.name === option.name); if (!matched) { // Shouldn't occur but just in case - this.client.logger.warn( + this.logger.warn( `Command interaction option mismatch:\nCommand: ${command.name}\nReceived subcommand ${subcommand.name}` ); continue;