mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 14:11:50 +00:00
cases: allow using user overrides for log_automatic_actions
This commit is contained in:
parent
9883610a3b
commit
17e388ff48
1 changed files with 4 additions and 3 deletions
|
@ -3,7 +3,7 @@ import { GuildPluginData } from "knub";
|
||||||
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
|
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
|
||||||
import { resolveCaseId } from "./resolveCaseId";
|
import { resolveCaseId } from "./resolveCaseId";
|
||||||
import { postCaseToCaseLogChannel } from "./postToCaseLogChannel";
|
import { postCaseToCaseLogChannel } from "./postToCaseLogChannel";
|
||||||
import { resolveUser } from "../../../utils";
|
import { resolveUser, UnknownUser } from "../../../utils";
|
||||||
|
|
||||||
export async function createCaseNote(pluginData: GuildPluginData<CasesPluginType>, args: CaseNoteArgs): Promise<void> {
|
export async function createCaseNote(pluginData: GuildPluginData<CasesPluginType>, args: CaseNoteArgs): Promise<void> {
|
||||||
const theCase = await pluginData.state.cases.find(resolveCaseId(args.caseId));
|
const theCase = await pluginData.state.cases.find(resolveCaseId(args.caseId));
|
||||||
|
@ -12,7 +12,7 @@ export async function createCaseNote(pluginData: GuildPluginData<CasesPluginType
|
||||||
}
|
}
|
||||||
|
|
||||||
const mod = await resolveUser(pluginData.client, args.modId);
|
const mod = await resolveUser(pluginData.client, args.modId);
|
||||||
if (!mod) {
|
if (mod instanceof UnknownUser) {
|
||||||
throw new RecoverablePluginError(ERRORS.INVALID_USER);
|
throw new RecoverablePluginError(ERRORS.INVALID_USER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,8 @@ export async function createCaseNote(pluginData: GuildPluginData<CasesPluginType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!args.automatic || pluginData.config.get().log_automatic_actions) && args.postInCaseLogOverride !== false) {
|
const modConfig = pluginData.config.getForUser(mod);
|
||||||
|
if ((!args.automatic || modConfig.log_automatic_actions) && args.postInCaseLogOverride !== false) {
|
||||||
await postCaseToCaseLogChannel(pluginData, theCase.id);
|
await postCaseToCaseLogChannel(pluginData, theCase.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue