3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Fix merge conflict

This commit is contained in:
Dragory 2020-05-22 20:55:15 +03:00
commit fd947ba191
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -237,6 +237,8 @@ export class AutomodPlugin extends ZeppelinPlugin<TConfigSchema, ICustomOverride
protected cooldownManager: CooldownManager;
protected onMessageCreateFn;
protected actionedMessageIds: string[];
protected actionedMessageMax = 50;
protected savedMessages: GuildSavedMessages;
protected archives: GuildArchives;
@ -349,6 +351,7 @@ export class AutomodPlugin extends ZeppelinPlugin<TConfigSchema, ICustomOverride
this.onMessageCreateFn = msg => this.onMessageCreate(msg);
this.savedMessages.events.on("create", this.onMessageCreateFn);
this.savedMessages.events.on("update", this.onMessageCreateFn);
this.actionedMessageIds = [];
}
protected getModActions(): ModActionsPlugin {
@ -1483,6 +1486,7 @@ export class AutomodPlugin extends ZeppelinPlugin<TConfigSchema, ICustomOverride
*/
protected onMessageCreate(msg: SavedMessage) {
if (msg.is_bot) return;
if (this.actionedMessageIds.includes(msg.id)) return;
this.automodQueue.add(async () => {
if (this.unloaded) return;
@ -1506,6 +1510,13 @@ export class AutomodPlugin extends ZeppelinPlugin<TConfigSchema, ICustomOverride
if (!savedMsg) return;
await this.applyActionsOnMatch(rule, matchResult);
// Add message ID to actioned messages to prevent alert spam on small edits
this.actionedMessageIds.push(msg.id);
while (this.actionedMessageIds.length > this.actionedMessageMax) {
this.actionedMessageIds.shift();
}
break; // Don't apply multiple rules to the same message
}
}