automod: fix memberJoinSpam trigger returning duplicate contexts

This commit is contained in:
Dragory 2020-07-30 22:23:44 +03:00
parent 2b92f726e1
commit 4931c95872
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -30,11 +30,7 @@ export const MemberJoinSpamTrigger = automodTrigger<unknown>()({
const totalCount = sumRecentActionCounts(matchingActions); const totalCount = sumRecentActionCounts(matchingActions);
if (totalCount >= triggerConfig.amount) { if (totalCount >= triggerConfig.amount) {
const contexts = [context, ...matchingActions.map(a => a.context).filter(c => c !== context)]; const extraContexts = matchingActions.map(a => a.context).filter(c => c !== context);
for (const _context of contexts) {
_context.actioned = true;
}
pluginData.state.recentSpam.push({ pluginData.state.recentSpam.push({
type: RecentActionType.MemberJoin, type: RecentActionType.MemberJoin,
@ -44,7 +40,7 @@ export const MemberJoinSpamTrigger = automodTrigger<unknown>()({
}); });
return { return {
extraContexts: contexts, extraContexts,
}; };
} }
}, },