From 4fd72895cdadceff533c8a0c398cfaad158ebfad Mon Sep 17 00:00:00 2001 From: almeidx Date: Mon, 8 Jan 2024 00:25:27 +0000 Subject: [PATCH] only call `disableInvites()` if value has changed --- backend/src/plugins/Automod/actions/pauseInvites.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/src/plugins/Automod/actions/pauseInvites.ts b/backend/src/plugins/Automod/actions/pauseInvites.ts index 1bbea34fa..262b69125 100644 --- a/backend/src/plugins/Automod/actions/pauseInvites.ts +++ b/backend/src/plugins/Automod/actions/pauseInvites.ts @@ -1,3 +1,4 @@ +import { GuildFeature } from "discord.js"; import * as t from "io-ts"; import { automodAction } from "../helpers"; @@ -9,6 +10,10 @@ export const PauseInvitesAction = automodAction({ defaultConfig: {}, async apply({ pluginData, actionConfig }) { - await pluginData.guild.disableInvites(actionConfig.paused); + const hasInvitesDisabled = pluginData.guild.features.includes(GuildFeature.InvitesDisabled); + + if (actionConfig.paused !== hasInvitesDisabled) { + await pluginData.guild.disableInvites(actionConfig.paused); + } }, });