3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-07 11:07:19 +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

@ -23,21 +23,9 @@ import { RestPerformanceCmd } from "./commands/RestPerformanceCmd.js";
import { ServersCmd } from "./commands/ServersCmd.js";
import { BotControlPluginType, zBotControlConfig } from "./types.js";
const defaultOptions = {
config: {
can_use: false,
can_eligible: false,
can_performance: false,
can_add_server_from_invite: false,
can_list_dashboard_perms: false,
update_cmd: null,
},
};
export const BotControlPlugin = globalPlugin<BotControlPluginType>()({
name: "bot_control",
configParser: (input) => zBotControlConfig.parse(input),
defaultOptions,
configSchema: zBotControlConfig,
// prettier-ignore
messageCommands: [

View file

@ -7,16 +7,16 @@ import { GuildArchives } from "../../data/GuildArchives.js";
import { zBoundedCharacters } from "../../utils.js";
export const zBotControlConfig = z.strictObject({
can_use: z.boolean(),
can_eligible: z.boolean(),
can_performance: z.boolean(),
can_add_server_from_invite: z.boolean(),
can_list_dashboard_perms: z.boolean(),
update_cmd: zBoundedCharacters(0, 2000).nullable(),
can_use: z.boolean().default(false),
can_eligible: z.boolean().default(false),
can_performance: z.boolean().default(false),
can_add_server_from_invite: z.boolean().default(false),
can_list_dashboard_perms: z.boolean().default(false),
update_cmd: zBoundedCharacters(0, 2000).nullable().default(null),
});
export interface BotControlPluginType extends BasePluginType {
config: z.output<typeof zBotControlConfig>;
configSchema: typeof zBotControlConfig;
state: {
archives: GuildArchives;
allowedGuilds: AllowedGuilds;