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

feat: rename and change config shape

This commit is contained in:
Ben Richeson 2023-08-30 13:32:45 -04:00
parent 8a99f33aa0
commit d69a9c3dc7
No known key found for this signature in database
GPG key ID: 5CE9197BA65BF9B8
3 changed files with 14 additions and 16 deletions

View file

@ -8,6 +8,7 @@ import { BanAction } from "./ban";
import { ChangeNicknameAction } from "./changeNickname";
import { ChangePermsAction } from "./changePerms";
import { CleanAction } from "./clean";
import { DisableInvitesAction } from "./disableInvites";
import { KickAction } from "./kick";
import { LogAction } from "./log";
import { MuteAction } from "./mute";
@ -17,7 +18,6 @@ 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>> = {
@ -39,7 +39,7 @@ export const availableActions: Record<string, AutomodActionBlueprint<any>> = {
start_thread: StartThreadAction,
archive_thread: ArchiveThreadAction,
change_perms: ChangePermsAction,
toggle_invites: ToggleInvitesAction,
disable_invites: DisableInvitesAction,
};
export const AvailableActions = t.type({
@ -61,5 +61,5 @@ export const AvailableActions = t.type({
start_thread: StartThreadAction.configType,
archive_thread: ArchiveThreadAction.configType,
change_perms: ChangePermsAction.configType,
toggle_invites: ToggleInvitesAction.configType,
disable_invites: DisableInvitesAction.configType,
});

View file

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

View file

@ -1,13 +0,0 @@
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);
},
});