3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-06-08 00:05:01 +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

@ -7,20 +7,11 @@ import { LoadDataEvt } from "./events/LoadDataEvt.js";
import { StoreDataEvt } from "./events/StoreDataEvt.js";
import { PersistPluginType, zPersistConfig } from "./types.js";
const defaultOptions: PluginOptions<PersistPluginType> = {
config: {
persisted_roles: [],
persist_nicknames: false,
persist_voice_mutes: false,
},
};
export const PersistPlugin = guildPlugin<PersistPluginType>()({
name: "persist",
dependencies: () => [LogsPlugin, RoleManagerPlugin],
configParser: (input) => zPersistConfig.parse(input),
defaultOptions,
configSchema: zPersistConfig,
// prettier-ignore
events: [

View file

@ -5,14 +5,13 @@ import { GuildPersistedData } from "../../data/GuildPersistedData.js";
import { zSnowflake } from "../../utils.js";
export const zPersistConfig = z.strictObject({
persisted_roles: z.array(zSnowflake),
persist_nicknames: z.boolean(),
persist_voice_mutes: z.boolean(),
persisted_roles: z.array(zSnowflake).default([]),
persist_nicknames: z.boolean().default(false),
persist_voice_mutes: z.boolean().default(false),
});
export interface PersistPluginType extends BasePluginType {
config: z.infer<typeof zPersistConfig>;
configSchema: typeof zPersistConfig;
state: {
persistedData: GuildPersistedData;
logs: GuildLogs;