3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

Allow Automod to distinguish whether mod actions are manual or automatic (#179)

This commit is contained in:
Nils 2021-04-28 21:06:33 +02:00 committed by GitHub
parent 90b6f4bc86
commit 51db942d97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 106 additions and 32 deletions

View file

@ -5,13 +5,25 @@ import { automodTrigger } from "../helpers";
interface BanTriggerResultType {}
export const BanTrigger = automodTrigger<BanTriggerResultType>()({
configType: t.type({}),
defaultConfig: {},
configType: t.type({
manual: t.boolean,
automatic: t.boolean,
}),
async match({ context }) {
defaultConfig: {
manual: true,
automatic: true,
},
async match({ context, triggerConfig }) {
if (context.modAction?.type !== "ban") {
return;
}
console.log(context);
// If automatic && automatic turned off -> return
if (context.modAction.isAutomodAction && !triggerConfig.automatic) return;
// If manual && manual turned off -> return
if (!context.modAction.isAutomodAction && !triggerConfig.manual) return;
return {
extra: {},

View file

@ -5,13 +5,24 @@ import { automodTrigger } from "../helpers";
interface KickTriggerResultType {}
export const KickTrigger = automodTrigger<KickTriggerResultType>()({
configType: t.type({}),
defaultConfig: {},
configType: t.type({
manual: t.boolean,
automatic: t.boolean,
}),
async match({ context }) {
defaultConfig: {
manual: true,
automatic: true,
},
async match({ context, triggerConfig }) {
if (context.modAction?.type !== "kick") {
return;
}
// If automatic && automatic turned off -> return
if (context.modAction.isAutomodAction && !triggerConfig.automatic) return;
// If manual && manual turned off -> return
if (!context.modAction.isAutomodAction && !triggerConfig.manual) return;
return {
extra: {},

View file

@ -5,13 +5,24 @@ import { automodTrigger } from "../helpers";
interface MuteTriggerResultType {}
export const MuteTrigger = automodTrigger<MuteTriggerResultType>()({
configType: t.type({}),
defaultConfig: {},
configType: t.type({
manual: t.boolean,
automatic: t.boolean,
}),
async match({ context }) {
defaultConfig: {
manual: true,
automatic: true,
},
async match({ context, triggerConfig }) {
if (context.modAction?.type !== "mute") {
return;
}
// If automatic && automatic turned off -> return
if (context.modAction.isAutomodAction && !triggerConfig.automatic) return;
// If manual && manual turned off -> return
if (!context.modAction.isAutomodAction && !triggerConfig.manual) return;
return {
extra: {},

View file

@ -5,13 +5,24 @@ import { automodTrigger } from "../helpers";
interface WarnTriggerResultType {}
export const WarnTrigger = automodTrigger<WarnTriggerResultType>()({
configType: t.type({}),
defaultConfig: {},
configType: t.type({
manual: t.boolean,
automatic: t.boolean,
}),
async match({ context }) {
defaultConfig: {
manual: true,
automatic: true,
},
async match({ context, triggerConfig }) {
if (context.modAction?.type !== "warn") {
return;
}
// If automatic && automatic turned off -> return
if (context.modAction.isAutomodAction && !triggerConfig.automatic) return;
// If manual && manual turned off -> return
if (!context.modAction.isAutomodAction && !triggerConfig.manual) return;
return {
extra: {},