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
|
@ -11,12 +11,11 @@ import { LocateUserPluginType, zLocateUserConfig } from "./types.js";
|
|||
import { clearExpiredAlert } from "./utils/clearExpiredAlert.js";
|
||||
import { fillActiveAlertsList } from "./utils/fillAlertsList.js";
|
||||
|
||||
const defaultOptions: PluginOptions<LocateUserPluginType> = {
|
||||
config: {
|
||||
can_where: false,
|
||||
can_alert: false,
|
||||
},
|
||||
overrides: [
|
||||
export const LocateUserPlugin = guildPlugin<LocateUserPluginType>()({
|
||||
name: "locate_user",
|
||||
|
||||
configSchema: zLocateUserConfig,
|
||||
defaultOverrides: [
|
||||
{
|
||||
level: ">=50",
|
||||
config: {
|
||||
|
@ -25,13 +24,6 @@ const defaultOptions: PluginOptions<LocateUserPluginType> = {
|
|||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const LocateUserPlugin = guildPlugin<LocateUserPluginType>()({
|
||||
name: "locate_user",
|
||||
|
||||
configParser: (input) => zLocateUserConfig.parse(input),
|
||||
defaultOptions,
|
||||
|
||||
// prettier-ignore
|
||||
messageCommands: [
|
||||
|
|
|
@ -4,12 +4,12 @@ import { GuildVCAlerts } from "../../data/GuildVCAlerts.js";
|
|||
import { CommonPlugin } from "../Common/CommonPlugin.js";
|
||||
|
||||
export const zLocateUserConfig = z.strictObject({
|
||||
can_where: z.boolean(),
|
||||
can_alert: z.boolean(),
|
||||
can_where: z.boolean().default(false),
|
||||
can_alert: z.boolean().default(false),
|
||||
});
|
||||
|
||||
export interface LocateUserPluginType extends BasePluginType {
|
||||
config: z.infer<typeof zLocateUserConfig>;
|
||||
configSchema: typeof zLocateUserConfig;
|
||||
state: {
|
||||
alerts: GuildVCAlerts;
|
||||
usersWithAlerts: string[];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue