mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
fix createCase()
This commit is contained in:
parent
feeb048855
commit
ea6df32da5
1 changed files with 9 additions and 6 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import type { Snowflake } from "discord-api-types/globals";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { logger } from "../../../logger";
|
import { logger } from "../../../logger";
|
||||||
import { resolveUser } from "../../../utils";
|
import { resolveUser } from "../../../utils";
|
||||||
|
@ -13,9 +14,11 @@ export async function createCase(pluginData: GuildPluginData<CasesPluginType>, a
|
||||||
const modName = mod.tag;
|
const modName = mod.tag;
|
||||||
|
|
||||||
let ppName: string | null = null;
|
let ppName: string | null = null;
|
||||||
|
let ppId: Snowflake | null = null;
|
||||||
if (args.ppId) {
|
if (args.ppId) {
|
||||||
const pp = await resolveUser(pluginData.client, args.ppId);
|
const pp = await resolveUser(pluginData.client, args.ppId);
|
||||||
ppName = pp.tag;
|
ppName = pp.tag;
|
||||||
|
ppId = pp.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.auditLogId) {
|
if (args.auditLogId) {
|
||||||
|
@ -28,20 +31,20 @@ export async function createCase(pluginData: GuildPluginData<CasesPluginType>, a
|
||||||
|
|
||||||
const createdCase = await pluginData.state.cases.create({
|
const createdCase = await pluginData.state.cases.create({
|
||||||
type: args.type,
|
type: args.type,
|
||||||
user_id: args.userId,
|
user_id: user.id,
|
||||||
user_name: userName,
|
user_name: userName,
|
||||||
mod_id: args.modId,
|
mod_id: mod.id,
|
||||||
mod_name: modName,
|
mod_name: modName,
|
||||||
audit_log_id: args.auditLogId,
|
audit_log_id: args.auditLogId,
|
||||||
pp_id: args.ppId,
|
pp_id: ppId,
|
||||||
pp_name: ppName,
|
pp_name: ppName,
|
||||||
is_hidden: Boolean(args.hide),
|
is_hidden: Boolean(args.hide),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (args.reason || (args.noteDetails && args.noteDetails.length)) {
|
if (args.reason || args.noteDetails?.length) {
|
||||||
await createCaseNote(pluginData, {
|
await createCaseNote(pluginData, {
|
||||||
caseId: createdCase.id,
|
caseId: createdCase.id,
|
||||||
modId: args.modId,
|
modId: mod.id,
|
||||||
body: args.reason || "",
|
body: args.reason || "",
|
||||||
automatic: args.automatic,
|
automatic: args.automatic,
|
||||||
postInCaseLogOverride: false,
|
postInCaseLogOverride: false,
|
||||||
|
@ -53,7 +56,7 @@ export async function createCase(pluginData: GuildPluginData<CasesPluginType>, a
|
||||||
for (const extraNote of args.extraNotes) {
|
for (const extraNote of args.extraNotes) {
|
||||||
await createCaseNote(pluginData, {
|
await createCaseNote(pluginData, {
|
||||||
caseId: createdCase.id,
|
caseId: createdCase.id,
|
||||||
modId: args.modId,
|
modId: mod.id,
|
||||||
body: extraNote,
|
body: extraNote,
|
||||||
automatic: args.automatic,
|
automatic: args.automatic,
|
||||||
postInCaseLogOverride: false,
|
postInCaseLogOverride: false,
|
||||||
|
|
Loading…
Add table
Reference in a new issue