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

feat(AutomodPlugin): toggle invite action

This commit is contained in:
Ben Richeson 2023-08-30 01:20:42 -04:00
parent 047ab872df
commit 8a99f33aa0
No known key found for this signature in database
GPG key ID: 5CE9197BA65BF9B8
2 changed files with 16 additions and 0 deletions

View file

@ -17,6 +17,7 @@ import { SetAntiraidLevelAction } from "./setAntiraidLevel";
import { SetCounterAction } from "./setCounter";
import { SetSlowmodeAction } from "./setSlowmode";
import { StartThreadAction } from "./startThread";
import { ToggleInvitesAction } from "./toggleInvites";
import { WarnAction } from "./warn";
export const availableActions: Record<string, AutomodActionBlueprint<any>> = {
@ -38,6 +39,7 @@ export const availableActions: Record<string, AutomodActionBlueprint<any>> = {
start_thread: StartThreadAction,
archive_thread: ArchiveThreadAction,
change_perms: ChangePermsAction,
toggle_invites: ToggleInvitesAction,
};
export const AvailableActions = t.type({
@ -59,4 +61,5 @@ export const AvailableActions = t.type({
start_thread: StartThreadAction.configType,
archive_thread: ArchiveThreadAction.configType,
change_perms: ChangePermsAction.configType,
toggle_invites: ToggleInvitesAction.configType,
});

View file

@ -0,0 +1,13 @@
import * as t from "io-ts";
import { automodAction } from "../helpers";
export const ToggleInvitesAction = automodAction({
configType: t.type({
enabled: t.boolean,
}),
defaultConfig: {},
async apply({ pluginData, actionConfig }) {
await pluginData.guild.disableInvites(!actionConfig.enabled);
},
});