3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-07 02:57:20 +00:00

only call disableInvites() if value has changed

This commit is contained in:
almeidx 2024-01-08 00:25:27 +00:00
parent f58e7f5eb7
commit 4fd72895cd
No known key found for this signature in database
GPG key ID: 54402591B9053451

View file

@ -1,3 +1,4 @@
import { GuildFeature } from "discord.js";
import * as t from "io-ts"; import * as t from "io-ts";
import { automodAction } from "../helpers"; import { automodAction } from "../helpers";
@ -9,6 +10,10 @@ export const PauseInvitesAction = automodAction({
defaultConfig: {}, defaultConfig: {},
async apply({ pluginData, actionConfig }) { 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);
}
}, },
}); });