mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35:02 +00:00
Add custom logger. Fix a bunch of errors. Optimize imports.
This commit is contained in:
parent
0dae54745d
commit
1064a1ca46
89 changed files with 198 additions and 229 deletions
|
@ -1,6 +1,5 @@
|
|||
import { zeppelinPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { CaseArgs, CaseNoteArgs, CasesPluginType, ConfigSchema } from "./types";
|
||||
import { resolveUser } from "../../utils";
|
||||
import { createCase } from "./functions/createCase";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildArchives } from "../../data/GuildArchives";
|
||||
|
|
|
@ -2,7 +2,8 @@ import { CaseArgs, CasesPluginType } from "../types";
|
|||
import { resolveUser } from "../../../utils";
|
||||
import { PluginData } from "knub";
|
||||
import { createCaseNote } from "./createCaseNote";
|
||||
import { postToCaseLogChannel } from "./postToCaseLogChannel";
|
||||
import { postCaseToCaseLogChannel } from "./postToCaseLogChannel";
|
||||
import { logger } from "../../../logger";
|
||||
|
||||
export async function createCase(pluginData: PluginData<CasesPluginType>, args: CaseArgs) {
|
||||
const user = await resolveUser(pluginData.client, args.userId);
|
||||
|
@ -21,7 +22,7 @@ export async function createCase(pluginData: PluginData<CasesPluginType>, args:
|
|||
const existingAuditLogCase = await pluginData.state.cases.findByAuditLogId(args.auditLogId);
|
||||
if (existingAuditLogCase) {
|
||||
delete args.auditLogId;
|
||||
console.warn(`Duplicate audit log ID for mod case: ${args.auditLogId}`);
|
||||
logger.warn(`Duplicate audit log ID for mod case: ${args.auditLogId}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,7 +67,7 @@ export async function createCase(pluginData: PluginData<CasesPluginType>, args:
|
|||
(!args.automatic || config.log_automatic_actions) &&
|
||||
args.postInCaseLogOverride !== false
|
||||
) {
|
||||
await postToCaseLogChannel(pluginData, createdCase);
|
||||
await postCaseToCaseLogChannel(pluginData, createdCase);
|
||||
}
|
||||
|
||||
return createdCase;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { plugin, PluginData } from "knub";
|
||||
import { PluginData } from "knub";
|
||||
import { CasesPluginType } from "../types";
|
||||
import { Message, MessageContent, MessageFile, TextChannel } from "eris";
|
||||
import { isDiscordRESTError } from "../../../utils";
|
||||
|
@ -6,6 +6,7 @@ import { LogType } from "../../../data/LogType";
|
|||
import { Case } from "../../../data/entities/Case";
|
||||
import { getCaseEmbed } from "./getCaseEmbed";
|
||||
import { resolveCaseId } from "./resolveCaseId";
|
||||
import { logger } from "../../../logger";
|
||||
|
||||
export async function postToCaseLogChannel(
|
||||
pluginData: PluginData<CasesPluginType>,
|
||||
|
@ -23,7 +24,7 @@ export async function postToCaseLogChannel(
|
|||
result = await caseLogChannel.createMessage(content, file);
|
||||
} catch (e) {
|
||||
if (isDiscordRESTError(e) && (e.code === 50013 || e.code === 50001)) {
|
||||
console.warn(
|
||||
logger.warn(
|
||||
`Missing permissions to post mod cases in <#${caseLogChannel.id}> in guild ${pluginData.guild.name} (${pluginData.guild.id})`,
|
||||
);
|
||||
pluginData.state.logs.log(LogType.BOT_ALERT, {
|
||||
|
|
|
@ -4,9 +4,7 @@ import { CaseTypes } from "../../data/CaseTypes";
|
|||
import { BasePluginType } from "knub";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildCases } from "../../data/GuildCases";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { GuildArchives } from "../../data/GuildArchives";
|
||||
import { Supporters } from "../../data/Supporters";
|
||||
|
||||
export const ConfigSchema = t.type({
|
||||
log_automatic_actions: t.boolean,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue