Skip to content

Commit

Permalink
only call disableInvites() if value has changed
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidx committed Jan 8, 2024
1 parent f58e7f5 commit 4fd7289
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion backend/src/plugins/Automod/actions/pauseInvites.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { GuildFeature } from "discord.js";
import * as t from "io-ts";
import { automodAction } from "../helpers";

Expand All @@ -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);
}
},
});

0 comments on commit 4fd7289

Please sign in to comment.