3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-06-17 11:25:03 +00:00

refactor: move defaults to config schemas

This commit is contained in:
Dragory 2025-05-23 01:12:52 +00:00
parent 09eb8e92f2
commit 83d35052c3
No known key found for this signature in database
91 changed files with 450 additions and 888 deletions

View file

@ -16,18 +16,11 @@ import { LogsPlugin } from "../Logs/LogsPlugin.js";
import { runEvent } from "./functions/runEvent.js";
import { CustomEventsPluginType, zCustomEventsConfig } from "./types.js";
const defaultOptions = {
config: {
events: {},
},
};
export const CustomEventsPlugin = guildPlugin<CustomEventsPluginType>()({
name: "custom_events",
dependencies: () => [LogsPlugin],
configParser: (input) => zCustomEventsConfig.parse(input),
defaultOptions,
configSchema: zCustomEventsConfig,
beforeStart(pluginData) {
pluginData.state.common = pluginData.getPlugin(CommonPlugin);

View file

@ -37,11 +37,11 @@ export const zCustomEvent = z.strictObject({
export type TCustomEvent = z.infer<typeof zCustomEvent>;
export const zCustomEventsConfig = z.strictObject({
events: zBoundedRecord(z.record(zBoundedCharacters(0, 100), zCustomEvent), 0, 100),
events: zBoundedRecord(z.record(zBoundedCharacters(0, 100), zCustomEvent), 0, 100).default({}),
});
export interface CustomEventsPluginType extends BasePluginType {
config: z.infer<typeof zCustomEventsConfig>;
configSchema: typeof zCustomEventsConfig;
state: {
clearTriggers: () => void;
common: pluginUtils.PluginPublicInterface<typeof CommonPlugin>;