This commit is contained in:
Dragory 2020-07-30 20:15:35 +03:00
parent f6d55f1060
commit def8e037ef
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -6,7 +6,7 @@ export const CleanAction = automodAction({
configType: t.boolean,
defaultConfig: false,
async apply({ pluginData, contexts }) {
async apply({ pluginData, contexts, ruleName }) {
const messageIdsToDeleteByChannelId: Map<string, string[]> = new Map();
for (const context of contexts) {
if (context.message) {
@ -14,6 +14,11 @@ export const CleanAction = automodAction({
messageIdsToDeleteByChannelId.set(context.message.channel_id, []);
}
if (messageIdsToDeleteByChannelId.get(context.message.channel_id).includes(context.message.id)) {
console.warn(`Message ID to delete was already present: ${pluginData.guild.name}, rule ${ruleName}`);
continue;
}
messageIdsToDeleteByChannelId.get(context.message.channel_id).push(context.message.id);
}
}