This commit is contained in:
Erik 2022-03-26 22:16:23 +02:00
parent db2701eb21
commit 0d50e925e6
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
3 changed files with 8 additions and 15 deletions

View File

@ -35,7 +35,7 @@ class MuteCommand extends SlashCommand {
async execute(thing, options) {
fruck;
//fruck;
console.log(options);

View File

@ -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;

View File

@ -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;