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:
parent
09eb8e92f2
commit
83d35052c3
91 changed files with 450 additions and 888 deletions
|
@ -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: [
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue