mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-08 03:27:20 +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
|
@ -6,11 +6,11 @@ import { CommonPlugin } from "../Common/CommonPlugin.js";
|
|||
import { NamesCmd } from "./commands/NamesCmd.js";
|
||||
import { NameHistoryPluginType, zNameHistoryConfig } from "./types.js";
|
||||
|
||||
const defaultOptions: PluginOptions<NameHistoryPluginType> = {
|
||||
config: {
|
||||
can_view: false,
|
||||
},
|
||||
overrides: [
|
||||
export const NameHistoryPlugin = guildPlugin<NameHistoryPluginType>()({
|
||||
name: "name_history",
|
||||
|
||||
configSchema: zNameHistoryConfig,
|
||||
defaultOverrides: [
|
||||
{
|
||||
level: ">=50",
|
||||
config: {
|
||||
|
@ -18,13 +18,6 @@ const defaultOptions: PluginOptions<NameHistoryPluginType> = {
|
|||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const NameHistoryPlugin = guildPlugin<NameHistoryPluginType>()({
|
||||
name: "name_history",
|
||||
|
||||
configParser: (input) => zNameHistoryConfig.parse(input),
|
||||
defaultOptions,
|
||||
|
||||
// prettier-ignore
|
||||
messageCommands: [
|
||||
|
|
|
@ -6,11 +6,11 @@ import { UsernameHistory } from "../../data/UsernameHistory.js";
|
|||
import { CommonPlugin } from "../Common/CommonPlugin.js";
|
||||
|
||||
export const zNameHistoryConfig = z.strictObject({
|
||||
can_view: z.boolean(),
|
||||
can_view: z.boolean().default(false),
|
||||
});
|
||||
|
||||
export interface NameHistoryPluginType extends BasePluginType {
|
||||
config: z.infer<typeof zNameHistoryConfig>;
|
||||
configSchema: typeof zNameHistoryConfig;
|
||||
state: {
|
||||
nicknameHistory: GuildNicknameHistory;
|
||||
usernameHistory: UsernameHistory;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue