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

only call disableInvites() if value has changed (#443)

This commit is contained in:
Almeida 2024-01-08 11:15:57 +00:00 committed by GitHub
parent f58e7f5eb7
commit 47ad8fa4d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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