mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-07 02:57:20 +00:00
feat: rename and change config shape
This commit is contained in:
parent
8a99f33aa0
commit
d69a9c3dc7
3 changed files with 14 additions and 16 deletions
|
@ -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,
|
||||
});
|
||||
|
|
11
backend/src/plugins/Automod/actions/disableInvites.ts
Normal file
11
backend/src/plugins/Automod/actions/disableInvites.ts
Normal 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);
|
||||
},
|
||||
});
|
|
@ -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);
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue