Fix log_automatic_actions option not working for automod actions

This commit is contained in:
Dragory 2021-04-02 19:36:40 +03:00
parent 53b64682ee
commit cc795c9742
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
4 changed files with 12 additions and 4 deletions

View file

@ -4,6 +4,7 @@ import { LogType } from "../../../data/LogType";
import { asyncMap, nonNullish, resolveMember, tNullable, unique } from "../../../utils";
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { CaseArgs } from "../../Cases/types";
export const BanAction = automodAction({
configType: t.type({
@ -22,9 +23,10 @@ export const BanAction = automodAction({
const contactMethods = actionConfig.notify ? resolveActionContactMethods(pluginData, actionConfig) : undefined;
const deleteMessageDays = actionConfig.deleteMessageDays || undefined;
const caseArgs = {
const caseArgs: Partial<CaseArgs> = {
modId: pluginData.client.user.id,
extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [],
automatic: true,
};
const userIdsToBan = unique(contexts.map(c => c.user?.id).filter(nonNullish));

View file

@ -4,6 +4,7 @@ import { LogType } from "../../../data/LogType";
import { asyncMap, nonNullish, resolveMember, tNullable, unique } from "../../../utils";
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { CaseArgs } from "../../Cases/types";
export const KickAction = automodAction({
configType: t.type({
@ -20,9 +21,10 @@ export const KickAction = automodAction({
const reason = actionConfig.reason || "Kicked automatically";
const contactMethods = actionConfig.notify ? resolveActionContactMethods(pluginData, actionConfig) : undefined;
const caseArgs = {
const caseArgs: Partial<CaseArgs> = {
modId: pluginData.client.user.id,
extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [],
automatic: true,
};
const userIdsToKick = unique(contexts.map(c => c.user?.id).filter(nonNullish));

View file

@ -15,6 +15,7 @@ import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { MutesPlugin } from "../../Mutes/MutesPlugin";
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { CaseArgs } from "../../Cases/types";
export const MuteAction = automodAction({
configType: t.type({
@ -37,9 +38,10 @@ export const MuteAction = automodAction({
const rolesToRemove = actionConfig.remove_roles_on_mute;
const rolesToRestore = actionConfig.restore_roles_on_mute;
const caseArgs = {
const caseArgs: Partial<CaseArgs> = {
modId: pluginData.client.user.id,
extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [],
automatic: true,
};
const userIdsToMute = unique(contexts.map(c => c.user?.id).filter(nonNullish));

View file

@ -4,6 +4,7 @@ import { LogType } from "../../../data/LogType";
import { asyncMap, nonNullish, resolveMember, tNullable, unique } from "../../../utils";
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { CaseArgs } from "../../Cases/types";
export const WarnAction = automodAction({
configType: t.type({
@ -20,9 +21,10 @@ export const WarnAction = automodAction({
const reason = actionConfig.reason || "Warned automatically";
const contactMethods = actionConfig.notify ? resolveActionContactMethods(pluginData, actionConfig) : undefined;
const caseArgs = {
const caseArgs: Partial<CaseArgs> = {
modId: pluginData.client.user.id,
extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [],
automatic: true,
};
const userIdsToWarn = unique(contexts.map(c => c.user?.id).filter(nonNullish));