automod: fix mutes not applying

This commit is contained in:
Dragory 2020-01-12 17:17:01 +02:00
parent bec583f96a
commit 73dc0d00fb
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -519,10 +519,6 @@ export class AutomodPlugin extends ZeppelinPlugin<TConfigSchema> {
protected onMessageCreateFn; protected onMessageCreateFn;
protected modActions: ModActionsPlugin;
protected mutes: MutesPlugin;
protected logs: LogsPlugin;
protected savedMessages: GuildSavedMessages; protected savedMessages: GuildSavedMessages;
protected archives: GuildArchives; protected archives: GuildArchives;
protected guildLogs: GuildLogs; protected guildLogs: GuildLogs;
@ -600,6 +596,10 @@ export class AutomodPlugin extends ZeppelinPlugin<TConfigSchema> {
return this.getPlugin("logs"); return this.getPlugin("logs");
} }
protected getMutes(): MutesPlugin {
return this.getPlugin("mutes");
}
protected onUnload() { protected onUnload() {
this.unloaded = true; this.unloaded = true;
this.savedMessages.events.off("create", this.onMessageCreateFn); this.savedMessages.events.off("create", this.onMessageCreateFn);
@ -1185,10 +1185,10 @@ export class AutomodPlugin extends ZeppelinPlugin<TConfigSchema> {
}; };
if (matchResult.type === "message" || matchResult.type === "embed" || matchResult.type === "textspam") { if (matchResult.type === "message" || matchResult.type === "embed" || matchResult.type === "textspam") {
await this.mutes.muteUser(matchResult.userId, duration, reason, caseArgs); await this.getMutes().muteUser(matchResult.userId, duration, reason, caseArgs);
} else if (matchResult.type === "raidspam") { } else if (matchResult.type === "raidspam") {
for (const userId of matchResult.userIds) { for (const userId of matchResult.userIds) {
await this.mutes.muteUser(userId, duration, reason, caseArgs); await this.getMutes().muteUser(userId, duration, reason, caseArgs);
} }
} }