Add pause_invites
automod action (#423)
* feat(AutomodPlugin): toggle invite action * feat: rename and change config shape * refactor: rename disable_invites to pause_invites * fix: make options an object, else setting an action to `false` ignores it
This commit is contained in:
parent
3912523c92
commit
094e94f0f4
2 changed files with 17 additions and 0 deletions
|
@ -11,6 +11,7 @@ import { CleanAction } from "./clean";
|
||||||
import { KickAction } from "./kick";
|
import { KickAction } from "./kick";
|
||||||
import { LogAction } from "./log";
|
import { LogAction } from "./log";
|
||||||
import { MuteAction } from "./mute";
|
import { MuteAction } from "./mute";
|
||||||
|
import { PauseInvitesAction } from "./pauseInvites";
|
||||||
import { RemoveRolesAction } from "./removeRoles";
|
import { RemoveRolesAction } from "./removeRoles";
|
||||||
import { ReplyAction } from "./reply";
|
import { ReplyAction } from "./reply";
|
||||||
import { SetAntiraidLevelAction } from "./setAntiraidLevel";
|
import { SetAntiraidLevelAction } from "./setAntiraidLevel";
|
||||||
|
@ -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,
|
||||||
|
pause_invites: PauseInvitesAction,
|
||||||
};
|
};
|
||||||
|
|
||||||
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,
|
||||||
|
pause_invites: PauseInvitesAction.configType,
|
||||||
});
|
});
|
||||||
|
|
14
backend/src/plugins/Automod/actions/pauseInvites.ts
Normal file
14
backend/src/plugins/Automod/actions/pauseInvites.ts
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import * as t from "io-ts";
|
||||||
|
import { automodAction } from "../helpers";
|
||||||
|
|
||||||
|
export const PauseInvitesAction = automodAction({
|
||||||
|
configType: t.type({
|
||||||
|
paused: t.boolean,
|
||||||
|
}),
|
||||||
|
|
||||||
|
defaultConfig: {},
|
||||||
|
|
||||||
|
async apply({ pluginData, actionConfig }) {
|
||||||
|
await pluginData.guild.disableInvites(actionConfig.paused);
|
||||||
|
},
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue