mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
chore: prettier
This commit is contained in:
parent
cb2306e522
commit
32875c23e9
13 changed files with 26 additions and 29 deletions
|
@ -1,9 +1,9 @@
|
|||
import express from "express";
|
||||
import z from "zod";
|
||||
import { indentLines } from "../utils.js";
|
||||
import { notFound } from "./responses.js";
|
||||
import { availableGuildPlugins } from "../plugins/availablePlugins.js";
|
||||
import { ZeppelinGuildPluginInfo } from "../types.js";
|
||||
import { indentLines } from "../utils.js";
|
||||
import { notFound } from "./responses.js";
|
||||
|
||||
function isZodObject(schema: z.ZodTypeAny): schema is z.ZodObject<any> {
|
||||
return schema._def.typeName === "ZodObject";
|
||||
|
@ -97,22 +97,27 @@ function formatZodConfigSchema(schema: z.ZodTypeAny) {
|
|||
return "unknown";
|
||||
}
|
||||
|
||||
const availableGuildPluginsByName = availableGuildPlugins.reduce<Record<string, ZeppelinGuildPluginInfo>>((map, obj) => {
|
||||
const availableGuildPluginsByName = availableGuildPlugins.reduce<Record<string, ZeppelinGuildPluginInfo>>(
|
||||
(map, obj) => {
|
||||
map[obj.plugin.name] = obj;
|
||||
return map;
|
||||
}, {});
|
||||
},
|
||||
{},
|
||||
);
|
||||
|
||||
export function initDocs(router: express.Router) {
|
||||
const docsPlugins = availableGuildPlugins.filter(obj => obj.docs.type !== "internal");
|
||||
const docsPlugins = availableGuildPlugins.filter((obj) => obj.docs.type !== "internal");
|
||||
|
||||
router.get("/docs/plugins", (req: express.Request, res: express.Response) => {
|
||||
res.json(docsPlugins.map(obj => ({
|
||||
res.json(
|
||||
docsPlugins.map((obj) => ({
|
||||
name: obj.plugin.name,
|
||||
info: {
|
||||
prettyName: obj.docs.prettyName,
|
||||
type: obj.docs.type,
|
||||
},
|
||||
})));
|
||||
})),
|
||||
);
|
||||
});
|
||||
|
||||
router.get("/docs/plugins/:pluginName", (req: express.Request, res: express.Response) => {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { ConfigValidationError, GuildPluginBlueprint, PluginConfigManager } from "knub";
|
||||
import moment from "moment-timezone";
|
||||
import { ZodError } from "zod";
|
||||
import { availableGuildPlugins } from "./plugins/availablePlugins.js";
|
||||
import { ZeppelinGuildConfig, zZeppelinGuildConfig } from "./types.js";
|
||||
import { formatZodIssue } from "./utils/formatZodIssue.js";
|
||||
import { availableGuildPlugins } from "./plugins/availablePlugins.js";
|
||||
|
||||
const pluginNameToPlugin = new Map<string, GuildPluginBlueprint<any, any>>();
|
||||
for (const pluginInfo of availableGuildPlugins) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { z } from "zod";
|
||||
import { zodToJsonSchema } from "zod-to-json-schema";
|
||||
import { zZeppelinGuildConfig } from "./types.js";
|
||||
import { availableGuildPlugins } from "./plugins/availablePlugins.js";
|
||||
import { zZeppelinGuildConfig } from "./types.js";
|
||||
|
||||
const pluginSchemaMap = availableGuildPlugins.reduce((map, pluginInfo) => {
|
||||
map[pluginInfo.plugin.name] = pluginInfo.docs.configSchema;
|
||||
|
|
|
@ -40,7 +40,7 @@ import { runUpcomingScheduledPostsLoop } from "./data/loops/upcomingScheduledPos
|
|||
import { consumeQueryStats } from "./data/queryLogger.js";
|
||||
import { env } from "./env.js";
|
||||
import { logger } from "./logger.js";
|
||||
import { availableGuildPlugins, availableGlobalPlugins } from "./plugins/availablePlugins.js";
|
||||
import { availableGlobalPlugins, availableGuildPlugins } from "./plugins/availablePlugins.js";
|
||||
import { setProfiler } from "./profiler.js";
|
||||
import { logRateLimit } from "./rateLimitStats.js";
|
||||
import { startUptimeCounter } from "./uptime.js";
|
||||
|
@ -283,8 +283,8 @@ connect().then(async () => {
|
|||
const guildConfigs = new Configs();
|
||||
|
||||
const bot = new Knub(client, {
|
||||
guildPlugins: availableGuildPlugins.map(obj => obj.plugin),
|
||||
globalPlugins: availableGlobalPlugins.map(obj => obj.plugin),
|
||||
guildPlugins: availableGuildPlugins.map((obj) => obj.plugin),
|
||||
globalPlugins: availableGlobalPlugins.map((obj) => obj.plugin),
|
||||
|
||||
options: {
|
||||
canLoadGuild(guildId): Promise<boolean> {
|
||||
|
@ -303,7 +303,7 @@ connect().then(async () => {
|
|||
}
|
||||
|
||||
const configuredPlugins = ctx.config.plugins;
|
||||
const autoloadPluginNames = availableGuildPlugins.filter(obj => obj.autoload).map(obj => obj.plugin.name);
|
||||
const autoloadPluginNames = availableGuildPlugins.filter((obj) => obj.autoload).map((obj) => obj.plugin.name);
|
||||
|
||||
return Array.from(plugins.keys()).filter((pluginName) => {
|
||||
if (autoloadPluginNames.includes(pluginName)) return true;
|
||||
|
|
|
@ -6,7 +6,6 @@ import { DisableAutoReactionsCmd } from "./commands/DisableAutoReactionsCmd.js";
|
|||
import { NewAutoReactionsCmd } from "./commands/NewAutoReactionsCmd.js";
|
||||
import { AddReactionsEvt } from "./events/AddReactionsEvt.js";
|
||||
import { AutoReactionsPluginType, zAutoReactionsConfig } from "./types.js";
|
||||
import { autoReactionsPluginDocs } from "./docs.js";
|
||||
|
||||
const defaultOptions: PluginOptions<AutoReactionsPluginType> = {
|
||||
config: {
|
||||
|
|
|
@ -32,7 +32,6 @@ import { clearOldRecentNicknameChanges } from "./functions/clearOldNicknameChang
|
|||
import { clearOldRecentActions } from "./functions/clearOldRecentActions.js";
|
||||
import { clearOldRecentSpam } from "./functions/clearOldRecentSpam.js";
|
||||
import { AutomodPluginType, zAutomodConfig } from "./types.js";
|
||||
import { automodPluginDocs } from "./docs.js";
|
||||
|
||||
const defaultOptions = {
|
||||
config: {
|
||||
|
|
|
@ -14,7 +14,6 @@ import { getRecentCasesByMod } from "./functions/getRecentCasesByMod.js";
|
|||
import { getTotalCasesByMod } from "./functions/getTotalCasesByMod.js";
|
||||
import { postCaseToCaseLogChannel } from "./functions/postToCaseLogChannel.js";
|
||||
import { CasesPluginType, zCasesConfig } from "./types.js";
|
||||
import { casesPluginDocs } from "./docs.js";
|
||||
|
||||
// The `any` cast here is to prevent TypeScript from locking up from the circular dependency
|
||||
function getLogsPlugin(): Promise<any> {
|
||||
|
|
|
@ -6,7 +6,6 @@ import { LogsPlugin } from "../Logs/LogsPlugin.js";
|
|||
import { CensorPluginType, zCensorConfig } from "./types.js";
|
||||
import { onMessageCreate } from "./util/onMessageCreate.js";
|
||||
import { onMessageUpdate } from "./util/onMessageUpdate.js";
|
||||
import { censorPluginDocs } from "./docs.js";
|
||||
|
||||
const defaultOptions: PluginOptions<CensorPluginType> = {
|
||||
config: {
|
||||
|
|
|
@ -3,7 +3,6 @@ import { GuildLogs } from "../../data/GuildLogs.js";
|
|||
import { LogsPlugin } from "../Logs/LogsPlugin.js";
|
||||
import { VoiceStateUpdateEvt } from "./events/VoiceStateUpdateEvt.js";
|
||||
import { CompanionChannelsPluginType, zCompanionChannelsConfig } from "./types.js";
|
||||
import { companionChannelsPluginDocs } from "./docs.js";
|
||||
|
||||
const defaultOptions = {
|
||||
config: {
|
||||
|
|
|
@ -6,7 +6,6 @@ import { UtilityPlugin } from "../Utility/UtilityPlugin.js";
|
|||
import { ContextClickedEvt } from "./events/ContextClickedEvt.js";
|
||||
import { ContextMenuPluginType, zContextMenusConfig } from "./types.js";
|
||||
import { loadAllCommands } from "./utils/loadAllCommands.js";
|
||||
import { contextMenuPluginDocs } from "./docs.js";
|
||||
|
||||
const defaultOptions: PluginOptions<ContextMenuPluginType> = {
|
||||
config: {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Guild } from "discord.js";
|
||||
import { BasePluginType, GlobalPluginData, globalPlugin, globalPluginEventListener } from "knub";
|
||||
import z from "zod";
|
||||
import { AllowedGuilds } from "../../data/AllowedGuilds.js";
|
||||
import { Configs } from "../../data/Configs.js";
|
||||
import { env } from "../../env.js";
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { z } from "zod";
|
||||
import { ZeppelinPluginDocs } from "../../types.js";
|
||||
import { trimPluginDescription } from "../../utils.js";
|
||||
import { zGuildAccessMonitorConfig } from "./types.js";
|
||||
|
|
|
@ -3,7 +3,7 @@ import type { Knub } from "knub";
|
|||
type Profiler = Knub["profiler"];
|
||||
let profiler: Profiler | null = null;
|
||||
|
||||
export function getProfiler(): Profiler|null {
|
||||
export function getProfiler(): Profiler | null {
|
||||
return profiler;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue