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:
parent
047ab872df
commit
8a99f33aa0
2 changed files with 16 additions and 0 deletions
|
@ -17,6 +17,7 @@ import { SetAntiraidLevelAction } from "./setAntiraidLevel";
|
||||||
import { SetCounterAction } from "./setCounter";
|
import { SetCounterAction } from "./setCounter";
|
||||||
import { SetSlowmodeAction } from "./setSlowmode";
|
import { SetSlowmodeAction } from "./setSlowmode";
|
||||||
import { StartThreadAction } from "./startThread";
|
import { StartThreadAction } from "./startThread";
|
||||||
|
import { ToggleInvitesAction } from "./toggleInvites";
|
||||||
import { WarnAction } from "./warn";
|
import { WarnAction } from "./warn";
|
||||||
|
|
||||||
export const availableActions: Record<string, AutomodActionBlueprint<any>> = {
|
export const availableActions: Record<string, AutomodActionBlueprint<any>> = {
|
||||||
|
@ -38,6 +39,7 @@ export const availableActions: Record<string, AutomodActionBlueprint<any>> = {
|
||||||
start_thread: StartThreadAction,
|
start_thread: StartThreadAction,
|
||||||
archive_thread: ArchiveThreadAction,
|
archive_thread: ArchiveThreadAction,
|
||||||
change_perms: ChangePermsAction,
|
change_perms: ChangePermsAction,
|
||||||
|
toggle_invites: ToggleInvitesAction,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AvailableActions = t.type({
|
export const AvailableActions = t.type({
|
||||||
|
@ -59,4 +61,5 @@ export const AvailableActions = t.type({
|
||||||
start_thread: StartThreadAction.configType,
|
start_thread: StartThreadAction.configType,
|
||||||
archive_thread: ArchiveThreadAction.configType,
|
archive_thread: ArchiveThreadAction.configType,
|
||||||
change_perms: ChangePermsAction.configType,
|
change_perms: ChangePermsAction.configType,
|
||||||
|
toggle_invites: ToggleInvitesAction.configType,
|
||||||
});
|
});
|
||||||
|
|
13
backend/src/plugins/Automod/actions/toggleInvites.ts
Normal file
13
backend/src/plugins/Automod/actions/toggleInvites.ts
Normal 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);
|
||||||
|
},
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue