@notenoughupdates/discord-akairo
Advanced tools
Comparing version 10.0.0-dev.1660093880.10e77cd3 to 10.0.0-dev.1660138634.99de920
{ | ||
"name": "@notenoughupdates/discord-akairo", | ||
"version": "10.0.0-dev.1660093880.10e77cd3", | ||
"version": "10.0.0-dev.1660138634.99de920", | ||
"description": "A highly customizable bot framework for Discord.js.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/src/index.js", |
import { Awaitable, Client, ClientOptions, Snowflake, UserResolvable } from "discord.js"; | ||
import { z } from "zod"; | ||
import type { AkairoClientEvents } from "../typings/events.js"; | ||
import { ArrayOrNot } from "../typings/Util.js"; | ||
import * as ClientUtil from "./ClientUtil.js"; | ||
@@ -28,11 +29,11 @@ export declare class AkairoClient<Ready extends boolean = boolean> extends Client<Ready> { | ||
export declare type AkairoClientOptions = { | ||
ownerID?: Snowflake | Snowflake[]; | ||
superUserID?: Snowflake | Snowflake[]; | ||
ownerID?: ArrayOrNot<Snowflake>; | ||
superUserID?: ArrayOrNot<Snowflake>; | ||
}; | ||
export declare const AkairoClientOptions: z.ZodObject<{ | ||
ownerID: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>; | ||
superUserID: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>; | ||
ownerID: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>; | ||
superUserID: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>; | ||
}, "passthrough", z.ZodTypeAny, { | ||
ownerID: string | string[]; | ||
superUserID: string | string[]; | ||
ownerID?: string | string[] | undefined; | ||
superUserID?: string | string[] | undefined; | ||
}, { | ||
@@ -39,0 +40,0 @@ ownerID?: string | string[] | undefined; |
@@ -29,2 +29,3 @@ "use strict"; | ||
const zod_1 = require("zod"); | ||
const Util_js_1 = require("../typings/Util.js"); | ||
const ClientUtil = __importStar(require("./ClientUtil.js")); | ||
@@ -58,6 +59,6 @@ class AkairoClient extends discord_js_1.Client { | ||
.object({ | ||
ownerID: zod_1.z.union([zod_1.z.string(), zod_1.z.string().array()]).default([]), | ||
superUserID: zod_1.z.union([zod_1.z.string(), zod_1.z.string().array()]).default([]) | ||
ownerID: (0, Util_js_1.ArrayOrNot)(zod_1.z.string()).optional(), | ||
superUserID: (0, Util_js_1.ArrayOrNot)(zod_1.z.string()).optional() | ||
}) | ||
.passthrough(); | ||
//# sourceMappingURL=AkairoClient.js.map |
@@ -41,13 +41,13 @@ import { Collection } from "discord.js"; | ||
export declare const AkairoHandlerOptions: z.ZodObject<{ | ||
automateCategories: z.ZodDefault<z.ZodBoolean>; | ||
automateCategories: z.ZodOptional<z.ZodBoolean>; | ||
classToHandle: z.ZodAny; | ||
directory: z.ZodString; | ||
extensions: z.ZodDefault<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodSet<z.ZodString>]>>; | ||
loadFilter: z.ZodDefault<z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodBoolean>>; | ||
extensions: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodSet<z.ZodString>]>>; | ||
loadFilter: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodBoolean>>; | ||
}, "passthrough", z.ZodTypeAny, { | ||
classToHandle?: any; | ||
extensions?: string[] | Set<string> | undefined; | ||
automateCategories?: boolean | undefined; | ||
loadFilter?: ((args_0: string, ...args_1: unknown[]) => boolean) | undefined; | ||
directory: string; | ||
extensions: string[] | Set<string>; | ||
automateCategories: boolean; | ||
loadFilter: (args_0: string, ...args_1: unknown[]) => boolean; | ||
}, { | ||
@@ -54,0 +54,0 @@ classToHandle?: any; |
@@ -21,3 +21,4 @@ "use strict"; | ||
zod_1.z.instanceof(AkairoClient_js_1.AkairoClient).parse(client); | ||
const { directory, classToHandle = AkairoModule_js_1.AkairoModule, extensions, automateCategories, loadFilter } = exports.AkairoHandlerOptions.parse(options); | ||
exports.AkairoHandlerOptions.parse(options); | ||
const { automateCategories = false, classToHandle = AkairoModule_js_1.AkairoModule, directory, extensions = [".js", ".json", ".ts"], loadFilter = () => true } = options; | ||
super(); | ||
@@ -155,9 +156,9 @@ this.client = client; | ||
.object({ | ||
automateCategories: zod_1.z.boolean().default(false), | ||
automateCategories: zod_1.z.boolean().optional(), | ||
classToHandle: zod_1.z.any(), | ||
directory: zod_1.z.string(), | ||
extensions: zod_1.z.union([exports.Extension.array(), zod_1.z.set(exports.Extension)]).default([".js", ".json", ".ts"]), | ||
loadFilter: exports.LoadPredicate.default(() => () => true) | ||
extensions: zod_1.z.union([exports.Extension.array(), zod_1.z.set(exports.Extension)]).optional(), | ||
loadFilter: exports.LoadPredicate.optional() | ||
}) | ||
.passthrough(); | ||
//# sourceMappingURL=AkairoHandler.js.map |
@@ -21,5 +21,5 @@ import { z } from "zod"; | ||
export declare const AkairoModuleOptions: z.ZodObject<{ | ||
category: z.ZodDefault<z.ZodString>; | ||
category: z.ZodOptional<z.ZodString>; | ||
}, "passthrough", z.ZodTypeAny, { | ||
category: string; | ||
category?: string | undefined; | ||
}, { | ||
@@ -26,0 +26,0 @@ category?: string | undefined; |
@@ -6,5 +6,6 @@ "use strict"; | ||
class AkairoModule { | ||
constructor(id, options) { | ||
constructor(id, options = {}) { | ||
zod_1.z.string().parse(id); | ||
const { category } = exports.AkairoModuleOptions.parse(options); | ||
exports.AkairoModuleOptions.parse(options); | ||
const { category = "default" } = options; | ||
this.id = id; | ||
@@ -30,5 +31,5 @@ this.categoryID = category; | ||
.object({ | ||
category: zod_1.z.string().default("default") | ||
category: zod_1.z.string().optional() | ||
}) | ||
.passthrough(); | ||
//# sourceMappingURL=AkairoModule.js.map |
@@ -12,15 +12,16 @@ "use strict"; | ||
constructor(command, options = {}) { | ||
const { match, type, flag, multipleFlags, index, unordered, limit, prompt, default: defaultValue, otherwise, modifyOtherwise } = exports.ArgumentOptions.parse(options); | ||
exports.ArgumentOptions.parse(options); | ||
const { match, type, flag, multipleFlags, index, unordered, limit, prompt, default: defaultValue, otherwise, modifyOtherwise } = options; | ||
this.command = command; | ||
this.match = match ?? Constants_js_1.ArgumentMatches.PHRASE; | ||
this.type = typeof type === "function" ? type.bind(this) : type; | ||
this.flag = flag; | ||
this.multipleFlags = multipleFlags; | ||
this.index = index; | ||
this.unordered = unordered; | ||
this.limit = limit; | ||
this.prompt = prompt; | ||
this.default = typeof defaultValue === "function" ? defaultValue.bind(this) : defaultValue; | ||
this.otherwise = typeof otherwise === "function" ? otherwise.bind(this) : otherwise; | ||
this.modifyOtherwise = modifyOtherwise; | ||
this.type = typeof type === "function" ? type.bind(this) : type ?? Constants_js_1.ArgumentTypes.STRING; | ||
this.flag = flag ?? null; | ||
this.multipleFlags = multipleFlags ?? false; | ||
this.index = index ?? null; | ||
this.unordered = unordered ?? false; | ||
this.limit = limit ?? Infinity; | ||
this.prompt = prompt ?? null; | ||
this.default = typeof defaultValue === "function" ? defaultValue.bind(this) : defaultValue ?? null; | ||
this.otherwise = typeof otherwise === "function" ? otherwise.bind(this) : otherwise ?? null; | ||
this.modifyOtherwise = modifyOtherwise ?? null; | ||
} | ||
@@ -400,8 +401,8 @@ get client() { | ||
exports.ArgumentPromptOptions = zod_1.z.object({ | ||
breakout: zod_1.z.boolean().default(true), | ||
breakout: zod_1.z.boolean().optional(), | ||
cancel: exports.ArgumentPromptResponse.optional(), | ||
cancelWord: zod_1.z.string().default("cancel"), | ||
cancelWord: zod_1.z.string().optional(), | ||
ended: exports.ArgumentPromptResponse.optional(), | ||
infinite: zod_1.z.boolean().default(false), | ||
limit: zod_1.z.number().default(Infinity), | ||
infinite: zod_1.z.boolean().optional(), | ||
limit: zod_1.z.number().optional(), | ||
modifyCancel: exports.PromptContentModifier.optional(), | ||
@@ -412,21 +413,11 @@ modifyEnded: exports.PromptContentModifier.optional(), | ||
modifyTimeout: exports.PromptContentModifier.optional(), | ||
optional: zod_1.z.boolean().default(false), | ||
retries: zod_1.z.number().default(1), | ||
optional: zod_1.z.boolean().optional(), | ||
retries: zod_1.z.number().optional(), | ||
retry: exports.ArgumentPromptResponse.optional(), | ||
start: exports.ArgumentPromptResponse.optional(), | ||
stopWord: zod_1.z.string().default("stop"), | ||
time: zod_1.z.number().default(30000), | ||
stopWord: zod_1.z.string().optional(), | ||
time: zod_1.z.number().optional(), | ||
timeout: exports.ArgumentPromptResponse.optional() | ||
}); | ||
exports.ArgumentMatch = zod_1.z.union([ | ||
zod_1.z.literal("phrase"), | ||
zod_1.z.literal("flag"), | ||
zod_1.z.literal("option"), | ||
zod_1.z.literal("rest"), | ||
zod_1.z.literal("separate"), | ||
zod_1.z.literal("text"), | ||
zod_1.z.literal("content"), | ||
zod_1.z.literal("restContent"), | ||
zod_1.z.literal("none") | ||
]); | ||
exports.ArgumentMatch = zod_1.z.enum(["phrase", "flag", "option", "rest", "separate", "text", "content", "restContent", "none"]); | ||
exports.ArgumentType = zod_1.z.union([zod_1.z.string(), zod_1.z.union([zod_1.z.string(), zod_1.z.string().array()]).array(), zod_1.z.instanceof(RegExp)]); | ||
@@ -450,14 +441,14 @@ exports.ArgumentTypeCaster = zod_1.z.function().args(Util_js_1.MessageInstance, zod_1.z.string()).returns(zod_1.z.any()); | ||
description: zod_1.z.any(), | ||
flag: zod_1.z.union([zod_1.z.string(), zod_1.z.string().array()]).nullish().default(null), | ||
flag: zod_1.z.union([zod_1.z.string(), zod_1.z.string().array()]).nullish(), | ||
id: zod_1.z.string().nullish(), | ||
index: zod_1.z.number().nullish().default(null), | ||
limit: zod_1.z.number().default(Infinity), | ||
match: zod_1.z.nativeEnum(Constants_js_1.ArgumentMatches).default(Constants_js_1.ArgumentMatches.PHRASE), | ||
modifyOtherwise: exports.OtherwiseContentModifier.nullish().default(null), | ||
multipleFlags: zod_1.z.boolean().default(false), | ||
index: zod_1.z.number().nullish(), | ||
limit: zod_1.z.number().optional(), | ||
match: zod_1.z.nativeEnum(Constants_js_1.ArgumentMatches).optional(), | ||
modifyOtherwise: exports.OtherwiseContentModifier.nullish().optional(), | ||
multipleFlags: zod_1.z.boolean().optional(), | ||
otherwise: zod_1.z.union([Util_js_1.MessageSendResolvable, exports.OtherwiseContentSupplier]).nullish(), | ||
prompt: zod_1.z.union([exports.ArgumentPromptOptions, zod_1.z.boolean()]).nullish().default(null), | ||
type: zod_1.z.union([exports.ArgumentType, exports.ArgumentTypeCaster]).default(Constants_js_1.ArgumentTypes.STRING), | ||
unordered: zod_1.z.union([zod_1.z.boolean(), zod_1.z.number(), zod_1.z.number().array()]).default(false) | ||
prompt: zod_1.z.union([exports.ArgumentPromptOptions, zod_1.z.boolean()]).nullish(), | ||
type: zod_1.z.union([exports.ArgumentType, exports.ArgumentTypeCaster]).optional(), | ||
unordered: zod_1.z.union([zod_1.z.boolean(), zod_1.z.number(), zod_1.z.number().array()]).optional() | ||
}); | ||
//# sourceMappingURL=Argument.js.map |
@@ -16,7 +16,8 @@ "use strict"; | ||
super(id, { category: options?.category }); | ||
let { aliases, args = this.args || [], argumentDefaults, before = this.before || (() => undefined), channel, clientPermissions = this.clientPermissions, condition = this.condition || (() => false), cooldown, description = "", editable, flags, ignoreCooldown, ignorePermissions, localization, lock, onlyNsfw, optionFlags, ownerOnly, prefix = this.prefix, quoted, ratelimit, regex = this.regex, separator, slash, slashDefaultMemberPermissions, slashDmPermission, slashEphemeral, slashGuilds, slashOnly, slashOptions, superUserOnly, typing, userPermissions } = exports.CommandOptions.parse(options); | ||
userPermissions ??= this.userPermissions; | ||
exports.CommandOptions.parse(options); | ||
const { aliases = [], args = this.args || [], argumentDefaults = {}, before = this.before || (() => undefined), channel = null, clientPermissions = this.clientPermissions, condition = this.condition || (() => false), cooldown = null, description = "", editable = true, flags = [], ignoreCooldown, ignorePermissions, localization, lock, onlyNsfw = false, optionFlags = [], ownerOnly = false, prefix = this.prefix, quoted = true, ratelimit = 1, regex = this.regex, separator, slash = false, slashEphemeral = false, slashGuilds = [], slashOnly = false, slashOptions, superUserOnly = false, typing = false, userPermissions = this.userPermissions } = options; | ||
let { slashDefaultMemberPermissions, slashDmPermission } = options; | ||
if (userPermissions && typeof userPermissions !== "function") | ||
slashDefaultMemberPermissions ??= userPermissions; | ||
if (slashGuilds.length > 0) | ||
if (slashGuilds.length === 0) | ||
slashDmPermission ??= channel === null || channel === "dm"; | ||
@@ -97,40 +98,37 @@ this.aliases = aliases; | ||
exports.CommandOptions = AkairoModule_js_1.AkairoModuleOptions.extend({ | ||
aliases: zod_1.z.string().array().default([]), | ||
aliases: zod_1.z.string().array().optional(), | ||
args: zod_1.z.union([Argument_js_1.ArgumentOptions.array(), exports.ArgumentGenerator]).optional(), | ||
argumentDefaults: Argument_js_1.DefaultArgumentOptions.default({}), | ||
argumentDefaults: Argument_js_1.DefaultArgumentOptions.optional(), | ||
before: exports.BeforeAction.optional(), | ||
channel: zod_1.z | ||
.union([zod_1.z.literal("guild"), zod_1.z.literal("dm")]) | ||
.nullish() | ||
.default(null), | ||
channel: zod_1.z.enum(["guild", "dm"]).nullish(), | ||
clientPermissions: zod_1.z.union([Util_js_1.PermissionResolvableValidator, exports.MissingPermissionSupplier]).optional(), | ||
condition: exports.ExecutionPredicate.optional(), | ||
cooldown: zod_1.z.number().nullish().default(null), | ||
description: zod_1.z.union([zod_1.z.string(), (0, Util_js_1.ArrayOrNot)(zod_1.z.any())]).default(""), | ||
editable: zod_1.z.boolean().default(true), | ||
flags: zod_1.z.string().array().default([]), | ||
cooldown: zod_1.z.number().nullish(), | ||
description: zod_1.z.union([zod_1.z.string(), (0, Util_js_1.ArrayOrNot)(zod_1.z.any())]).optional(), | ||
editable: zod_1.z.boolean().optional(), | ||
flags: zod_1.z.string().array().optional(), | ||
ignoreCooldown: zod_1.z.union([(0, Util_js_1.ArrayOrNot)(zod_1.z.string()), CommandHandler_js_1.IgnoreCheckPredicate]).optional(), | ||
ignorePermissions: zod_1.z.union([(0, Util_js_1.ArrayOrNot)(zod_1.z.string()), CommandHandler_js_1.IgnoreCheckPredicate]).optional(), | ||
localization: zod_1.z.record(zod_1.z.any()).default({}), | ||
lock: zod_1.z.union([exports.KeySupplier, zod_1.z.literal("guild"), zod_1.z.literal("channel"), zod_1.z.literal("user")]).optional(), | ||
onlyNsfw: zod_1.z.boolean().default(false), | ||
optionFlags: zod_1.z.string().array().default([]), | ||
ownerOnly: zod_1.z.boolean().default(false), | ||
localization: zod_1.z.record(zod_1.z.any()).optional(), | ||
lock: zod_1.z.union([exports.KeySupplier, zod_1.z.enum(["guild", "channel", "user"])]).optional(), | ||
onlyNsfw: zod_1.z.boolean().optional(), | ||
optionFlags: zod_1.z.string().array().optional(), | ||
ownerOnly: zod_1.z.boolean().optional(), | ||
prefix: zod_1.z.union([(0, Util_js_1.ArrayOrNot)(zod_1.z.string()), CommandHandler_js_1.PrefixSupplier]).optional(), | ||
quoted: zod_1.z.boolean().default(true), | ||
ratelimit: zod_1.z.number().default(1), | ||
quoted: zod_1.z.boolean().optional(), | ||
ratelimit: zod_1.z.number().optional(), | ||
regex: zod_1.z.union([zod_1.z.instanceof(RegExp), exports.RegexSupplier]).optional(), | ||
separator: zod_1.z.string().optional(), | ||
slash: zod_1.z.boolean().default(false), | ||
slash: zod_1.z.boolean().optional(), | ||
slashDefaultMemberPermissions: Util_js_1.PermissionResolvableValidator.optional(), | ||
slashDmPermission: zod_1.z.boolean().optional(), | ||
slashEphemeral: zod_1.z.boolean().default(false), | ||
slashGuilds: zod_1.z.string().array().default([]), | ||
slashEphemeral: zod_1.z.boolean().optional(), | ||
slashGuilds: zod_1.z.string().array().optional(), | ||
slashOptions: zod_1.z.any().array().optional(), | ||
slashOnly: zod_1.z.boolean().default(false), | ||
superUserOnly: zod_1.z.boolean().default(false), | ||
typing: zod_1.z.boolean().default(false), | ||
slashOnly: zod_1.z.boolean().optional(), | ||
superUserOnly: zod_1.z.boolean().optional(), | ||
typing: zod_1.z.boolean().optional(), | ||
userPermissions: zod_1.z.union([Util_js_1.PermissionResolvableValidator, exports.MissingPermissionSupplier]).optional() | ||
}); | ||
}).passthrough(); | ||
exports.CommandInstance = zod_1.z.instanceof(Command); | ||
//# sourceMappingURL=Command.js.map |
@@ -11,2 +11,3 @@ "use strict"; | ||
const Util_js_2 = require("../../util/Util.js"); | ||
const AkairoClient_js_1 = require("../AkairoClient.js"); | ||
const AkairoHandler_js_1 = require("../AkairoHandler.js"); | ||
@@ -21,3 +22,5 @@ const ContextMenuCommandHandler_js_1 = require("../contextMenuCommands/ContextMenuCommandHandler.js"); | ||
constructor(client, options) { | ||
const { directory, classToHandle = Command_js_1.Command, extensions = [".js", ".ts"], automateCategories, loadFilter, blockClient, blockBots, fetchMembers, handleEdits, storeMessages, commandUtil, commandUtilLifetime, commandUtilSweepInterval, defaultCooldown, ignoreCooldown = client.ownerID, ignorePermissions, argumentDefaults, prefix, allowMention, aliasReplacement, autoDefer, typing, autoRegisterSlashCommands, execSlash, skipBuiltInPostInhibitors } = exports.CommandHandlerOptions.parse(options); | ||
zod_1.z.instanceof(AkairoClient_js_1.AkairoClient).parse(client); | ||
exports.CommandHandlerOptions.parse(options); | ||
const { directory, classToHandle = Command_js_1.Command, extensions = [".js", ".ts"], automateCategories, loadFilter, blockClient = true, blockBots = true, fetchMembers = false, handleEdits = false, storeMessages = false, commandUtil = false, commandUtilLifetime = 3e5, commandUtilSweepInterval = 3e5, defaultCooldown = 0, ignoreCooldown = client.ownerID, ignorePermissions = [], argumentDefaults = {}, prefix = "!", allowMention = true, aliasReplacement, autoDefer = false, typing = false, autoRegisterSlashCommands = false, execSlash = false, skipBuiltInPostInhibitors = false } = options; | ||
if (!(classToHandle.prototype instanceof Command_js_1.Command || classToHandle === Command_js_1.Command)) { | ||
@@ -1004,34 +1007,34 @@ throw new AkairoError_js_1.AkairoError("INVALID_CLASS_TO_HANDLE", classToHandle.name, Command_js_1.Command.name); | ||
aliasReplacement: zod_1.z.instanceof(RegExp).optional(), | ||
allowMention: zod_1.z.union([zod_1.z.boolean(), exports.MentionPrefixPredicate]).default(true), | ||
argumentDefaults: Argument_js_1.DefaultArgumentOptions.default({}), | ||
autoDefer: zod_1.z.boolean().default(false), | ||
autoRegisterSlashCommands: zod_1.z.boolean().default(false), | ||
blockBots: zod_1.z.boolean().default(true), | ||
blockClient: zod_1.z.boolean().default(true), | ||
commandUtil: zod_1.z.boolean().default(false), | ||
commandUtilLifetime: zod_1.z.number().default(3e5), | ||
commandUtilSweepInterval: zod_1.z.number().default(3e5), | ||
defaultCooldown: zod_1.z.number().default(0), | ||
fetchMembers: zod_1.z.boolean().default(false), | ||
handleEdits: zod_1.z.boolean().default(false), | ||
allowMention: zod_1.z.union([zod_1.z.boolean(), exports.MentionPrefixPredicate]).optional(), | ||
argumentDefaults: Argument_js_1.DefaultArgumentOptions.optional(), | ||
autoDefer: zod_1.z.boolean().optional(), | ||
autoRegisterSlashCommands: zod_1.z.boolean().optional(), | ||
blockBots: zod_1.z.boolean().optional(), | ||
blockClient: zod_1.z.boolean().optional(), | ||
commandUtil: zod_1.z.boolean().optional(), | ||
commandUtilLifetime: zod_1.z.number().optional(), | ||
commandUtilSweepInterval: zod_1.z.number().optional(), | ||
defaultCooldown: zod_1.z.number().optional(), | ||
fetchMembers: zod_1.z.boolean().optional(), | ||
handleEdits: zod_1.z.boolean().optional(), | ||
ignoreCooldown: zod_1.z.union([(0, Util_js_1.ArrayOrNot)(zod_1.z.string()), exports.IgnoreCheckPredicate]).optional(), | ||
ignorePermissions: zod_1.z.union([(0, Util_js_1.ArrayOrNot)(zod_1.z.string()), exports.IgnoreCheckPredicate]).default([]), | ||
prefix: zod_1.z.union([(0, Util_js_1.ArrayOrNot)(zod_1.z.string()), exports.PrefixSupplier]).default("!"), | ||
storeMessages: zod_1.z.boolean().default(false), | ||
typing: zod_1.z.boolean().default(false), | ||
execSlash: zod_1.z.boolean().default(false), | ||
skipBuiltInPostInhibitors: zod_1.z.boolean().default(false) | ||
}); | ||
exports.SlashResolveType = zod_1.z.union([ | ||
zod_1.z.literal("Attachment"), | ||
zod_1.z.literal("Boolean"), | ||
zod_1.z.literal("Channel"), | ||
zod_1.z.literal("Integer"), | ||
zod_1.z.literal("Member"), | ||
zod_1.z.literal("Mentionable"), | ||
zod_1.z.literal("Number"), | ||
zod_1.z.literal("Role"), | ||
zod_1.z.literal("String"), | ||
zod_1.z.literal("User") | ||
ignorePermissions: zod_1.z.union([(0, Util_js_1.ArrayOrNot)(zod_1.z.string()), exports.IgnoreCheckPredicate]).optional(), | ||
prefix: zod_1.z.union([(0, Util_js_1.ArrayOrNot)(zod_1.z.string()), exports.PrefixSupplier]).optional(), | ||
storeMessages: zod_1.z.boolean().optional(), | ||
typing: zod_1.z.boolean().optional(), | ||
execSlash: zod_1.z.boolean().optional(), | ||
skipBuiltInPostInhibitors: zod_1.z.boolean().optional() | ||
}).passthrough(); | ||
exports.SlashResolveType = zod_1.z.enum([ | ||
"Attachment", | ||
"Boolean", | ||
"Channel", | ||
"Integer", | ||
"Member", | ||
"Mentionable", | ||
"Number", | ||
"Role", | ||
"String", | ||
"User" | ||
]); | ||
//# sourceMappingURL=CommandHandler.js.map |
@@ -8,3 +8,3 @@ import { z } from "zod"; | ||
separated: z.ZodBoolean; | ||
}, "strip", z.ZodTypeAny, { | ||
}, "passthrough", z.ZodTypeAny, { | ||
separated: boolean; | ||
@@ -30,15 +30,15 @@ }, { | ||
export declare const ContentParserOptions: z.ZodObject<{ | ||
flagWords: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; | ||
optionFlagWords: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; | ||
quoted: z.ZodDefault<z.ZodBoolean>; | ||
flagWords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; | ||
optionFlagWords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; | ||
quoted: z.ZodOptional<z.ZodBoolean>; | ||
separator: z.ZodOptional<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
}, "passthrough", z.ZodTypeAny, { | ||
quoted?: boolean | undefined; | ||
flagWords?: string[] | undefined; | ||
optionFlagWords?: string[] | undefined; | ||
separator?: string | undefined; | ||
flagWords: string[]; | ||
optionFlagWords: string[]; | ||
quoted: boolean; | ||
}, { | ||
quoted?: boolean | undefined; | ||
flagWords?: string[] | undefined; | ||
optionFlagWords?: string[] | undefined; | ||
quoted?: boolean | undefined; | ||
separator?: string | undefined; | ||
@@ -52,3 +52,3 @@ }>; | ||
raw: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
}, "passthrough", z.ZodTypeAny, { | ||
raw: string; | ||
@@ -67,3 +67,3 @@ }, { | ||
value: z.ZodString; | ||
}>, "strip", z.ZodTypeAny, { | ||
}>, "passthrough", z.ZodTypeAny, { | ||
type: "Phrase"; | ||
@@ -86,3 +86,3 @@ raw: string; | ||
key: z.ZodString; | ||
}>, "strip", z.ZodTypeAny, { | ||
}>, "passthrough", z.ZodTypeAny, { | ||
type: "Flag"; | ||
@@ -107,3 +107,3 @@ key: string; | ||
value: z.ZodString; | ||
}>, "strip", z.ZodTypeAny, { | ||
}>, "passthrough", z.ZodTypeAny, { | ||
type: "OptionFlag"; | ||
@@ -126,3 +126,3 @@ key: string; | ||
optionFlagWords: z.ZodArray<z.ZodString, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
}, "passthrough", z.ZodTypeAny, { | ||
flagWords: string[]; | ||
@@ -146,3 +146,3 @@ optionFlagWords: string[]; | ||
value: z.ZodString; | ||
}>, "strip", z.ZodTypeAny, { | ||
}>, "passthrough", z.ZodTypeAny, { | ||
type: "Phrase"; | ||
@@ -160,3 +160,3 @@ raw: string; | ||
key: z.ZodString; | ||
}>, "strip", z.ZodTypeAny, { | ||
}>, "passthrough", z.ZodTypeAny, { | ||
type: "Flag"; | ||
@@ -175,3 +175,3 @@ key: string; | ||
value: z.ZodString; | ||
}>, "strip", z.ZodTypeAny, { | ||
}>, "passthrough", z.ZodTypeAny, { | ||
type: "OptionFlag"; | ||
@@ -192,3 +192,3 @@ key: string; | ||
value: z.ZodString; | ||
}>, "strip", z.ZodTypeAny, { | ||
}>, "passthrough", z.ZodTypeAny, { | ||
type: "Phrase"; | ||
@@ -207,3 +207,3 @@ raw: string; | ||
key: z.ZodString; | ||
}>, "strip", z.ZodTypeAny, { | ||
}>, "passthrough", z.ZodTypeAny, { | ||
type: "Flag"; | ||
@@ -223,3 +223,3 @@ key: string; | ||
value: z.ZodString; | ||
}>, "strip", z.ZodTypeAny, { | ||
}>, "passthrough", z.ZodTypeAny, { | ||
type: "OptionFlag"; | ||
@@ -235,3 +235,3 @@ key: string; | ||
}>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
}, "passthrough", z.ZodTypeAny, { | ||
flags: { | ||
@@ -238,0 +238,0 @@ type: "Flag"; |
@@ -9,3 +9,4 @@ "use strict"; | ||
zod_1.z.string().parse(content); | ||
const { flagWords, optionFlagWords, quoted, separator } = exports.ContentParserOptions.parse(options); | ||
exports.ContentParserOptions.parse(options); | ||
const { flagWords = [], optionFlagWords = [], quoted = true, separator } = options; | ||
this.content = content; | ||
@@ -155,17 +156,9 @@ this.flagWords = flagWords; | ||
} | ||
const TokenType = zod_1.z.union([ | ||
zod_1.z.literal("FlagWord"), | ||
zod_1.z.literal("OptionFlagWord"), | ||
zod_1.z.literal("Quote"), | ||
zod_1.z.literal("OpenQuote"), | ||
zod_1.z.literal("EndQuote"), | ||
zod_1.z.literal("Word"), | ||
zod_1.z.literal("WS"), | ||
zod_1.z.literal("EOF"), | ||
zod_1.z.literal("Separator") | ||
]); | ||
const Token = zod_1.z.object({ | ||
const TokenType = zod_1.z.enum(["FlagWord", "OptionFlagWord", "Quote", "OpenQuote", "EndQuote", "Word", "WS", "EOF", "Separator"]); | ||
const Token = zod_1.z | ||
.object({ | ||
type: TokenType, | ||
value: zod_1.z.string() | ||
}); | ||
}) | ||
.passthrough(); | ||
var TokenizerState; | ||
@@ -180,3 +173,4 @@ (function (TokenizerState) { | ||
Token.array().parse(tokens); | ||
const { separated } = exports.ParserOptions.parse(options); | ||
exports.ParserOptions.parse(options); | ||
const { separated } = options; | ||
this.tokens = tokens; | ||
@@ -325,8 +319,11 @@ this.separated = separated; | ||
} | ||
exports.ParserOptions = zod_1.z.object({ | ||
exports.ParserOptions = zod_1.z | ||
.object({ | ||
separated: zod_1.z.boolean() | ||
}); | ||
}) | ||
.passthrough(); | ||
class ContentParser { | ||
constructor(options = {}) { | ||
const { flagWords, optionFlagWords, quoted, separator } = exports.ContentParserOptions.parse(options); | ||
exports.ContentParserOptions.parse(options); | ||
const { flagWords = [], optionFlagWords = [], quoted = true, separator } = options; | ||
this.flagWords = flagWords.sort((a, b) => b.length - a.length); | ||
@@ -366,19 +363,23 @@ this.optionFlagWords = optionFlagWords.sort((a, b) => b.length - a.length); | ||
exports.ContentParser = ContentParser; | ||
exports.ContentParserOptions = zod_1.z.object({ | ||
flagWords: zod_1.z.string().array().default([]), | ||
optionFlagWords: zod_1.z.string().array().default([]), | ||
quoted: zod_1.z.boolean().default(true), | ||
exports.ContentParserOptions = zod_1.z | ||
.object({ | ||
flagWords: zod_1.z.string().array().optional(), | ||
optionFlagWords: zod_1.z.string().array().optional(), | ||
quoted: zod_1.z.boolean().optional(), | ||
separator: zod_1.z.string().optional() | ||
}); | ||
const BaseParsed = zod_1.z.object({ | ||
}) | ||
.passthrough(); | ||
const BaseParsed = zod_1.z | ||
.object({ | ||
raw: zod_1.z.string() | ||
}); | ||
}) | ||
.passthrough(); | ||
const ParsedPhrase = BaseParsed.extend({ | ||
type: zod_1.z.literal("Phrase"), | ||
value: zod_1.z.string() | ||
}); | ||
}).passthrough(); | ||
const ParsedFlag = BaseParsed.extend({ | ||
type: zod_1.z.literal("Flag"), | ||
key: zod_1.z.string() | ||
}); | ||
}).passthrough(); | ||
const ParsedOptionFlag = BaseParsed.extend({ | ||
@@ -388,8 +389,11 @@ type: zod_1.z.literal("OptionFlag"), | ||
value: zod_1.z.string() | ||
}); | ||
exports.ExtractedFlags = zod_1.z.object({ | ||
}).passthrough(); | ||
exports.ExtractedFlags = zod_1.z | ||
.object({ | ||
flagWords: zod_1.z.string().array(), | ||
optionFlagWords: zod_1.z.string().array() | ||
}); | ||
exports.ContentParserResult = zod_1.z.object({ | ||
}) | ||
.passthrough(); | ||
exports.ContentParserResult = zod_1.z | ||
.object({ | ||
all: zod_1.z.union([ParsedPhrase, ParsedFlag, ParsedOptionFlag]).array(), | ||
@@ -399,3 +403,4 @@ phrases: ParsedPhrase.array(), | ||
optionFlags: ParsedOptionFlag.array() | ||
}); | ||
}) | ||
.passthrough(); | ||
//# sourceMappingURL=ContentParser.js.map |
@@ -28,8 +28,8 @@ import { ApplicationCommandType, type ContextMenuCommandInteraction, type LocalizationMap, type PermissionResolvable, type Snowflake } from "discord.js"; | ||
export declare const ContextMenuCommandOptions: z.ZodObject<z.extendShape<{ | ||
category: z.ZodDefault<z.ZodString>; | ||
category: z.ZodOptional<z.ZodString>; | ||
}, { | ||
guilds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; | ||
guilds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; | ||
name: z.ZodString; | ||
ownerOnly: z.ZodDefault<z.ZodBoolean>; | ||
superUserOnly: z.ZodDefault<z.ZodBoolean>; | ||
ownerOnly: z.ZodOptional<z.ZodBoolean>; | ||
superUserOnly: z.ZodOptional<z.ZodBoolean>; | ||
type: z.ZodUnion<[z.ZodLiteral<ApplicationCommandType.User>, z.ZodLiteral<ApplicationCommandType.Message>]>; | ||
@@ -43,8 +43,8 @@ nameLocalizations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodOptional<z.ZodString>>>>; | ||
defaultMemberPermissions?: PermissionResolvable | undefined; | ||
category?: string | undefined; | ||
ownerOnly?: boolean | undefined; | ||
superUserOnly?: boolean | undefined; | ||
guilds?: string[] | undefined; | ||
name: string; | ||
type: ApplicationCommandType.User | ApplicationCommandType.Message; | ||
category: string; | ||
guilds: string[]; | ||
ownerOnly: boolean; | ||
superUserOnly: boolean; | ||
}, { | ||
@@ -55,5 +55,5 @@ nameLocalizations?: Record<string, string | null | undefined> | undefined; | ||
category?: string | undefined; | ||
guilds?: string[] | undefined; | ||
ownerOnly?: boolean | undefined; | ||
superUserOnly?: boolean | undefined; | ||
guilds?: string[] | undefined; | ||
name: string; | ||
@@ -60,0 +60,0 @@ type: ApplicationCommandType.User | ApplicationCommandType.Message; |
@@ -11,3 +11,5 @@ "use strict"; | ||
constructor(id, options) { | ||
let { category, guilds, name, ownerOnly, superUserOnly, type, nameLocalizations, defaultMemberPermissions, dmPermission } = exports.ContextMenuCommandOptions.parse(options); | ||
exports.ContextMenuCommandOptions.parse(options); | ||
const { category, guilds = [], name, ownerOnly = false, superUserOnly = false, type, nameLocalizations, defaultMemberPermissions } = options; | ||
let { dmPermission } = options; | ||
if (dmPermission != null && guilds.length > 0) | ||
@@ -31,6 +33,6 @@ throw new TypeError("You cannot set `options.dmPermission` with commands configured with `options.guilds`."); | ||
exports.ContextMenuCommandOptions = AkairoModule_js_1.AkairoModuleOptions.extend({ | ||
guilds: zod_1.z.string().array().default([]), | ||
guilds: zod_1.z.string().array().optional(), | ||
name: zod_1.z.string(), | ||
ownerOnly: zod_1.z.boolean().default(false), | ||
superUserOnly: zod_1.z.boolean().default(false), | ||
ownerOnly: zod_1.z.boolean().optional(), | ||
superUserOnly: zod_1.z.boolean().optional(), | ||
type: zod_1.z.union([zod_1.z.literal(discord_js_1.ApplicationCommandType.User), zod_1.z.literal(discord_js_1.ApplicationCommandType.Message)]), | ||
@@ -37,0 +39,0 @@ nameLocalizations: zod_1.z.record(zod_1.z.string().nullish()).optional(), |
@@ -22,12 +22,12 @@ import type { Message } from "discord.js"; | ||
export declare const InhibitorOptions: z.ZodObject<z.extendShape<{ | ||
category: z.ZodDefault<z.ZodString>; | ||
category: z.ZodOptional<z.ZodString>; | ||
}, { | ||
reason: z.ZodDefault<z.ZodString>; | ||
type: z.ZodDefault<z.ZodEnum<["all", "pre", "post"]>>; | ||
priority: z.ZodDefault<z.ZodNumber>; | ||
reason: z.ZodOptional<z.ZodString>; | ||
type: z.ZodOptional<z.ZodEnum<["all", "pre", "post"]>>; | ||
priority: z.ZodOptional<z.ZodNumber>; | ||
}>, "passthrough", z.ZodTypeAny, { | ||
type: "all" | "pre" | "post"; | ||
reason: string; | ||
category: string; | ||
priority: number; | ||
type?: "all" | "pre" | "post" | undefined; | ||
reason?: string | undefined; | ||
category?: string | undefined; | ||
priority?: number | undefined; | ||
}, { | ||
@@ -34,0 +34,0 @@ type?: "all" | "pre" | "post" | undefined; |
@@ -10,3 +10,4 @@ "use strict"; | ||
constructor(id, options = {}) { | ||
const { category, reason, type, priority } = exports.InhibitorOptions.parse(options); | ||
exports.InhibitorOptions.parse(options); | ||
const { category, reason = "", type = "post", priority = 0 } = options; | ||
super(id, { category }); | ||
@@ -21,6 +22,6 @@ this.reason = reason; | ||
exports.InhibitorOptions = AkairoModule_js_1.AkairoModuleOptions.extend({ | ||
reason: zod_1.z.string().default(""), | ||
type: zod_1.z.enum(["all", "pre", "post"]).default("post"), | ||
priority: zod_1.z.number().default(0) | ||
reason: zod_1.z.string().optional(), | ||
type: zod_1.z.enum(["all", "pre", "post"]).optional(), | ||
priority: zod_1.z.number().optional() | ||
}).passthrough(); | ||
//# sourceMappingURL=Inhibitor.js.map |
@@ -13,3 +13,3 @@ import EventEmitter from "node:events"; | ||
export declare type ListenerType = "on" | "once" | "prependListener" | "prependOnceListener"; | ||
export declare const ListenerType: z.ZodUnion<[z.ZodLiteral<"on">, z.ZodLiteral<"once">, z.ZodLiteral<"prependListener">, z.ZodLiteral<"prependOnceListener">]>; | ||
export declare const ListenerType: z.ZodEnum<["on", "once", "prependListener", "prependOnceListener"]>; | ||
export declare type ListenerOptions = AkairoModuleOptions & { | ||
@@ -21,10 +21,10 @@ emitter: string | EventEmitter; | ||
export declare const ListenerOptions: z.ZodObject<z.extendShape<{ | ||
category: z.ZodDefault<z.ZodString>; | ||
category: z.ZodOptional<z.ZodString>; | ||
}, { | ||
emitter: z.ZodUnion<[z.ZodString, z.ZodType<EventEmitter, z.ZodTypeDef, EventEmitter>]>; | ||
event: z.ZodString; | ||
type: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"on">, z.ZodLiteral<"once">, z.ZodLiteral<"prependListener">, z.ZodLiteral<"prependOnceListener">]>>; | ||
type: z.ZodOptional<z.ZodEnum<["on", "once", "prependListener", "prependOnceListener"]>>; | ||
}>, "passthrough", z.ZodTypeAny, { | ||
type: "on" | "once" | "prependListener" | "prependOnceListener"; | ||
category: string; | ||
type?: "on" | "once" | "prependListener" | "prependOnceListener" | undefined; | ||
category?: string | undefined; | ||
emitter: string | EventEmitter; | ||
@@ -31,0 +31,0 @@ event: string; |
@@ -13,3 +13,4 @@ "use strict"; | ||
constructor(id, options) { | ||
const { category, emitter, event, type } = exports.ListenerOptions.parse(options); | ||
exports.ListenerOptions.parse(options); | ||
const { category, emitter, event, type = "on" } = options; | ||
super(id, { category }); | ||
@@ -23,13 +24,8 @@ this.emitter = emitter; | ||
(0, Util_js_1.patchAbstract)(Listener, "exec"); | ||
exports.ListenerType = zod_1.z.union([ | ||
zod_1.z.literal("on"), | ||
zod_1.z.literal("once"), | ||
zod_1.z.literal("prependListener"), | ||
zod_1.z.literal("prependOnceListener") | ||
]); | ||
exports.ListenerType = zod_1.z.enum(["on", "once", "prependListener", "prependOnceListener"]); | ||
exports.ListenerOptions = AkairoModule_js_1.AkairoModuleOptions.extend({ | ||
emitter: zod_1.z.union([zod_1.z.string(), zod_1.z.instanceof(node_events_1.default)]), | ||
event: zod_1.z.string(), | ||
type: exports.ListenerType.default("on") | ||
}); | ||
type: exports.ListenerType.optional() | ||
}).passthrough(); | ||
//# sourceMappingURL=Listener.js.map |
@@ -15,15 +15,15 @@ import { z } from "zod"; | ||
export declare const TaskOptions: z.ZodObject<z.extendShape<{ | ||
category: z.ZodDefault<z.ZodString>; | ||
category: z.ZodOptional<z.ZodString>; | ||
}, { | ||
delay: z.ZodOptional<z.ZodNumber>; | ||
runOnStart: z.ZodDefault<z.ZodBoolean>; | ||
runOnStart: z.ZodOptional<z.ZodBoolean>; | ||
}>, "passthrough", z.ZodTypeAny, { | ||
category?: string | undefined; | ||
runOnStart?: boolean | undefined; | ||
delay?: number | undefined; | ||
category: string; | ||
runOnStart: boolean; | ||
}, { | ||
category?: string | undefined; | ||
runOnStart?: boolean | undefined; | ||
delay?: number | undefined; | ||
runOnStart?: boolean | undefined; | ||
}>; | ||
//# sourceMappingURL=Task.d.ts.map |
@@ -9,3 +9,4 @@ "use strict"; | ||
constructor(id, options = {}) { | ||
const { category, delay, runOnStart } = exports.TaskOptions.parse(options); | ||
exports.TaskOptions.parse(options); | ||
const { category, delay, runOnStart = false } = options; | ||
super(id, { category }); | ||
@@ -20,4 +21,4 @@ this.delay = delay; | ||
delay: zod_1.z.number().optional(), | ||
runOnStart: zod_1.z.boolean().default(false) | ||
runOnStart: zod_1.z.boolean().optional() | ||
}).passthrough(); | ||
//# sourceMappingURL=Task.js.map |
{ | ||
"name": "@notenoughupdates/discord-akairo", | ||
"version": "10.0.0-dev.1660093880.10e77cd3", | ||
"version": "10.0.0-dev.1660138634.99de920", | ||
"description": "A highly customizable bot framework for Discord.js.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/src/index.js", |
import { Awaitable, Client, ClientOptions, Snowflake, UserResolvable } from "discord.js"; | ||
import { z } from "zod"; | ||
import type { AkairoClientEvents } from "../typings/events.js"; | ||
import { ArrayOrNot } from "../typings/Util.js"; | ||
import * as ClientUtil from "./ClientUtil.js"; | ||
@@ -90,3 +91,3 @@ | ||
*/ | ||
ownerID?: Snowflake | Snowflake[]; | ||
ownerID?: ArrayOrNot<Snowflake>; | ||
@@ -97,3 +98,3 @@ /** | ||
*/ | ||
superUserID?: Snowflake | Snowflake[]; | ||
superUserID?: ArrayOrNot<Snowflake>; | ||
}; | ||
@@ -103,5 +104,5 @@ | ||
.object({ | ||
ownerID: z.union([z.string(), z.string().array()]).default([]), | ||
superUserID: z.union([z.string(), z.string().array()]).default([]) | ||
ownerID: ArrayOrNot(z.string()).optional(), | ||
superUserID: ArrayOrNot(z.string()).optional() | ||
}) | ||
.passthrough(); |
@@ -68,10 +68,11 @@ import { Collection } from "discord.js"; | ||
z.instanceof(AkairoClient).parse(client); | ||
AkairoHandlerOptions.parse(options); | ||
const { | ||
automateCategories = false, | ||
classToHandle = AkairoModule, | ||
directory, | ||
classToHandle = AkairoModule, | ||
extensions, | ||
automateCategories, | ||
loadFilter | ||
} = AkairoHandlerOptions.parse(options); | ||
extensions = [".js", ".json", ".ts"], | ||
loadFilter = () => true | ||
} = options; | ||
@@ -317,8 +318,8 @@ super(); | ||
.object({ | ||
automateCategories: z.boolean().default(false), | ||
automateCategories: z.boolean().optional(), | ||
classToHandle: z.any(), | ||
directory: z.string(), | ||
extensions: z.union([Extension.array(), z.set(Extension)]).default([".js", ".json", ".ts"]), | ||
loadFilter: LoadPredicate.default(() => () => true) | ||
extensions: z.union([Extension.array(), z.set(Extension)]).optional(), | ||
loadFilter: LoadPredicate.optional() | ||
}) | ||
.passthrough(); |
@@ -44,6 +44,8 @@ import { z } from "zod"; | ||
*/ | ||
public constructor(id: string, options?: AkairoModuleOptions) { | ||
public constructor(id: string, options: AkairoModuleOptions = {}) { | ||
z.string().parse(id); | ||
const { category } = AkairoModuleOptions.parse(options); | ||
AkairoModuleOptions.parse(options); | ||
const { category = "default" } = options; | ||
this.id = id; | ||
@@ -92,4 +94,4 @@ this.categoryID = category; | ||
.object({ | ||
category: z.string().default("default") | ||
category: z.string().optional() | ||
}) | ||
.passthrough(); |
@@ -95,3 +95,3 @@ import { | ||
*/ | ||
public flag?: string | string[] | null; | ||
public flag: string | string[] | null; | ||
@@ -147,4 +147,5 @@ /** | ||
*/ | ||
// eslint-disable-next-line complexity | ||
public constructor(command: Command, options: ArgumentOptions = {}) { | ||
ArgumentOptions.parse(options); | ||
const { | ||
@@ -162,16 +163,16 @@ match, | ||
modifyOtherwise | ||
} = ArgumentOptions.parse(options); | ||
} = options; | ||
this.command = command; | ||
this.match = match ?? ArgumentMatches.PHRASE; | ||
this.type = typeof type === "function" ? type.bind(this) : type; | ||
this.flag = flag; | ||
this.multipleFlags = multipleFlags; | ||
this.index = index; | ||
this.unordered = unordered; | ||
this.limit = limit; | ||
this.prompt = prompt; | ||
this.default = typeof defaultValue === "function" ? defaultValue.bind(this) : defaultValue; | ||
this.otherwise = typeof otherwise === "function" ? otherwise.bind(this) : otherwise; | ||
this.modifyOtherwise = modifyOtherwise; | ||
this.type = typeof type === "function" ? type.bind(this) : type ?? ArgumentTypes.STRING; | ||
this.flag = flag ?? null; | ||
this.multipleFlags = multipleFlags ?? false; | ||
this.index = index ?? null; | ||
this.unordered = unordered ?? false; | ||
this.limit = limit ?? Infinity; | ||
this.prompt = prompt ?? null; | ||
this.default = typeof defaultValue === "function" ? defaultValue.bind(this) : defaultValue ?? null; | ||
this.otherwise = typeof otherwise === "function" ? otherwise.bind(this) : otherwise ?? null; | ||
this.modifyOtherwise = modifyOtherwise ?? null; | ||
} | ||
@@ -215,2 +216,7 @@ | ||
/* const promptOptions: ArgumentPromptOptions = {}; | ||
Object.assign(promptOptions, this.handler.argumentDefaults.prompt); | ||
Object.assign(promptOptions, this.command.argumentDefaults.prompt); | ||
Object.assign(promptOptions, this.prompt || {}); */ | ||
const isInfinite = promptOptions.infinite || (this.match === ArgumentMatches.SEPARATE && !commandInput); | ||
@@ -914,8 +920,8 @@ const additionalRetry = Number(Boolean(commandInput)); | ||
export const ArgumentPromptOptions = z.object({ | ||
breakout: z.boolean().default(true), | ||
breakout: z.boolean().optional(), | ||
cancel: ArgumentPromptResponse.optional(), | ||
cancelWord: z.string().default("cancel"), | ||
cancelWord: z.string().optional(), | ||
ended: ArgumentPromptResponse.optional(), | ||
infinite: z.boolean().default(false), | ||
limit: z.number().default(Infinity), | ||
infinite: z.boolean().optional(), | ||
limit: z.number().optional(), | ||
modifyCancel: PromptContentModifier.optional(), | ||
@@ -926,8 +932,8 @@ modifyEnded: PromptContentModifier.optional(), | ||
modifyTimeout: PromptContentModifier.optional(), | ||
optional: z.boolean().default(false), | ||
retries: z.number().default(1), | ||
optional: z.boolean().optional(), | ||
retries: z.number().optional(), | ||
retry: ArgumentPromptResponse.optional(), | ||
start: ArgumentPromptResponse.optional(), | ||
stopWord: z.string().default("stop"), | ||
time: z.number().default(30000), | ||
stopWord: z.string().optional(), | ||
time: z.number().optional(), | ||
timeout: ArgumentPromptResponse.optional() | ||
@@ -960,13 +966,3 @@ }); | ||
export const ArgumentMatch = z.union([ | ||
z.literal("phrase"), | ||
z.literal("flag"), | ||
z.literal("option"), | ||
z.literal("rest"), | ||
z.literal("separate"), | ||
z.literal("text"), | ||
z.literal("content"), | ||
z.literal("restContent"), | ||
z.literal("none") | ||
]); | ||
export const ArgumentMatch = z.enum(["phrase", "flag", "option", "rest", "separate", "text", "content", "restContent", "none"]); | ||
@@ -1231,3 +1227,3 @@ /** | ||
*/ | ||
limit?: number | null; | ||
limit?: number; | ||
@@ -1285,13 +1281,13 @@ /** | ||
description: z.any(), | ||
flag: z.union([z.string(), z.string().array()]).nullish().default(null), | ||
flag: z.union([z.string(), z.string().array()]).nullish(), | ||
id: z.string().nullish(), | ||
index: z.number().nullish().default(null), | ||
limit: z.number().default(Infinity), | ||
match: z.nativeEnum(ArgumentMatches).default(ArgumentMatches.PHRASE), | ||
modifyOtherwise: OtherwiseContentModifier.nullish().default(null), | ||
multipleFlags: z.boolean().default(false), | ||
index: z.number().nullish(), | ||
limit: z.number().optional(), | ||
match: z.nativeEnum(ArgumentMatches).optional(), | ||
modifyOtherwise: OtherwiseContentModifier.nullish().optional(), | ||
multipleFlags: z.boolean().optional(), | ||
otherwise: z.union([MessageSendResolvable, OtherwiseContentSupplier]).nullish(), | ||
prompt: z.union([ArgumentPromptOptions, z.boolean()]).nullish().default(null), | ||
type: z.union([ArgumentType, ArgumentTypeCaster]).default(ArgumentTypes.STRING), | ||
unordered: z.union([z.boolean(), z.number(), z.number().array()]).default(false) | ||
prompt: z.union([ArgumentPromptOptions, z.boolean()]).nullish(), | ||
type: z.union([ArgumentType, ArgumentTypeCaster]).optional(), | ||
unordered: z.union([z.boolean(), z.number(), z.number().array()]).optional() | ||
}); |
@@ -191,15 +191,16 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
/* eslint-disable prefer-const */ | ||
let { | ||
aliases, | ||
CommandOptions.parse(options); | ||
const { | ||
aliases = [], | ||
args = this.args || [], | ||
argumentDefaults, | ||
argumentDefaults = {}, | ||
before = this.before || (() => undefined), | ||
channel, | ||
channel = null, | ||
clientPermissions = this.clientPermissions, | ||
condition = this.condition || (() => false), | ||
cooldown, | ||
cooldown = null, | ||
description = "", | ||
editable, | ||
flags, | ||
editable = true, | ||
flags = [], | ||
ignoreCooldown, | ||
@@ -209,27 +210,24 @@ ignorePermissions, | ||
lock, | ||
onlyNsfw, | ||
optionFlags, | ||
ownerOnly, | ||
onlyNsfw = false, | ||
optionFlags = [], | ||
ownerOnly = false, | ||
prefix = this.prefix, | ||
quoted, | ||
ratelimit, | ||
quoted = true, | ||
ratelimit = 1, | ||
regex = this.regex, | ||
separator, | ||
slash, | ||
slashDefaultMemberPermissions, | ||
slashDmPermission, | ||
slashEphemeral, | ||
slashGuilds, | ||
slashOnly, | ||
slash = false, | ||
slashEphemeral = false, | ||
slashGuilds = [], | ||
slashOnly = false, | ||
slashOptions, | ||
superUserOnly, | ||
typing, | ||
userPermissions /* = this.userPermissions */ | ||
} = CommandOptions.parse(options); | ||
/* eslint-enable prefer-const */ | ||
superUserOnly = false, | ||
typing = false, | ||
userPermissions = this.userPermissions | ||
} = options; | ||
userPermissions ??= this.userPermissions; | ||
let { slashDefaultMemberPermissions, slashDmPermission } = options; | ||
if (userPermissions && typeof userPermissions !== "function") slashDefaultMemberPermissions ??= userPermissions; | ||
if (slashGuilds.length > 0) slashDmPermission ??= channel === null || channel === "dm"; | ||
if (slashGuilds.length === 0) slashDmPermission ??= channel === null || channel === "dm"; | ||
@@ -466,3 +464,3 @@ this.aliases = aliases; | ||
*/ | ||
channel?: "guild" | "dm"; | ||
channel?: "guild" | "dm" | null; | ||
@@ -485,3 +483,3 @@ /** | ||
*/ | ||
cooldown?: number; | ||
cooldown?: number | null; | ||
@@ -636,39 +634,36 @@ /** | ||
export const CommandOptions = AkairoModuleOptions.extend({ | ||
aliases: z.string().array().default([]), | ||
aliases: z.string().array().optional(), | ||
args: z.union([ArgumentOptions.array(), ArgumentGenerator]).optional(), | ||
argumentDefaults: DefaultArgumentOptions.default({}), | ||
argumentDefaults: DefaultArgumentOptions.optional(), | ||
before: BeforeAction.optional(), | ||
channel: z | ||
.union([z.literal("guild"), z.literal("dm")]) | ||
.nullish() | ||
.default(null), | ||
channel: z.enum(["guild", "dm"]).nullish(), | ||
clientPermissions: z.union([PermissionResolvableValidator, MissingPermissionSupplier]).optional(), | ||
condition: ExecutionPredicate.optional(), | ||
cooldown: z.number().nullish().default(null), | ||
description: z.union([z.string(), ArrayOrNot(z.any())]).default(""), | ||
editable: z.boolean().default(true), | ||
flags: z.string().array().default([]), | ||
cooldown: z.number().nullish(), | ||
description: z.union([z.string(), ArrayOrNot(z.any())]).optional(), | ||
editable: z.boolean().optional(), | ||
flags: z.string().array().optional(), | ||
ignoreCooldown: z.union([ArrayOrNot(z.string()), IgnoreCheckPredicate]).optional(), | ||
ignorePermissions: z.union([ArrayOrNot(z.string()), IgnoreCheckPredicate]).optional(), | ||
localization: z.record(z.any()).default({}), | ||
lock: z.union([KeySupplier, z.literal("guild"), z.literal("channel"), z.literal("user")]).optional(), | ||
onlyNsfw: z.boolean().default(false), | ||
optionFlags: z.string().array().default([]), | ||
ownerOnly: z.boolean().default(false), | ||
localization: z.record(z.any()).optional(), | ||
lock: z.union([KeySupplier, z.enum(["guild", "channel", "user"])]).optional(), | ||
onlyNsfw: z.boolean().optional(), | ||
optionFlags: z.string().array().optional(), | ||
ownerOnly: z.boolean().optional(), | ||
prefix: z.union([ArrayOrNot(z.string()), PrefixSupplier]).optional(), | ||
quoted: z.boolean().default(true), | ||
ratelimit: z.number().default(1), | ||
quoted: z.boolean().optional(), | ||
ratelimit: z.number().optional(), | ||
regex: z.union([z.instanceof(RegExp), RegexSupplier]).optional(), | ||
separator: z.string().optional(), | ||
slash: z.boolean().default(false), | ||
slash: z.boolean().optional(), | ||
slashDefaultMemberPermissions: PermissionResolvableValidator.optional(), | ||
slashDmPermission: z.boolean().optional(), | ||
slashEphemeral: z.boolean().default(false), | ||
slashGuilds: z.string().array().default([]), | ||
slashEphemeral: z.boolean().optional(), | ||
slashGuilds: z.string().array().optional(), | ||
slashOptions: z.any().array().optional(), | ||
slashOnly: z.boolean().default(false), | ||
superUserOnly: z.boolean().default(false), | ||
typing: z.boolean().default(false), | ||
slashOnly: z.boolean().optional(), | ||
superUserOnly: z.boolean().optional(), | ||
typing: z.boolean().optional(), | ||
userPermissions: z.union([PermissionResolvableValidator, MissingPermissionSupplier]).optional() | ||
}); | ||
}).passthrough(); | ||
@@ -675,0 +670,0 @@ export interface AkairoApplicationCommandSubGroupData extends ApplicationCommandSubGroupData { |
@@ -28,3 +28,3 @@ import { | ||
import { deepAssign, deepEquals, intoArray, intoCallable, isPromise, prefixCompare } from "../../util/Util.js"; | ||
import type { AkairoClient } from "../AkairoClient.js"; | ||
import { AkairoClient } from "../AkairoClient.js"; | ||
import { AkairoHandler, AkairoHandlerOptions, Extension } from "../AkairoHandler.js"; | ||
@@ -196,2 +196,5 @@ import { ContextMenuCommandHandler } from "../contextMenuCommands/ContextMenuCommandHandler.js"; | ||
public constructor(client: AkairoClient, options: CommandHandlerOptions) { | ||
z.instanceof(AkairoClient).parse(client); | ||
CommandHandlerOptions.parse(options); | ||
const { | ||
@@ -203,23 +206,23 @@ directory, | ||
loadFilter, | ||
blockClient, | ||
blockBots, | ||
fetchMembers, | ||
handleEdits, | ||
storeMessages, | ||
commandUtil, | ||
commandUtilLifetime, | ||
commandUtilSweepInterval, | ||
defaultCooldown, | ||
blockClient = true, | ||
blockBots = true, | ||
fetchMembers = false, | ||
handleEdits = false, | ||
storeMessages = false, | ||
commandUtil = false, | ||
commandUtilLifetime = 3e5, | ||
commandUtilSweepInterval = 3e5, | ||
defaultCooldown = 0, | ||
ignoreCooldown = client.ownerID, | ||
ignorePermissions, | ||
argumentDefaults, | ||
prefix, | ||
allowMention, | ||
ignorePermissions = [], | ||
argumentDefaults = {}, | ||
prefix = "!", | ||
allowMention = true, | ||
aliasReplacement, | ||
autoDefer, | ||
typing, | ||
autoRegisterSlashCommands, | ||
execSlash, | ||
skipBuiltInPostInhibitors | ||
} = CommandHandlerOptions.parse(options); | ||
autoDefer = false, | ||
typing = false, | ||
autoRegisterSlashCommands = false, | ||
execSlash = false, | ||
skipBuiltInPostInhibitors = false | ||
} = options; | ||
@@ -1635,22 +1638,22 @@ if (!(classToHandle.prototype instanceof Command || classToHandle === Command)) { | ||
aliasReplacement: z.instanceof(RegExp).optional(), | ||
allowMention: z.union([z.boolean(), MentionPrefixPredicate]).default(true), | ||
argumentDefaults: DefaultArgumentOptions.default({}), | ||
autoDefer: z.boolean().default(false), | ||
autoRegisterSlashCommands: z.boolean().default(false), | ||
blockBots: z.boolean().default(true), | ||
blockClient: z.boolean().default(true), | ||
commandUtil: z.boolean().default(false), | ||
commandUtilLifetime: z.number().default(3e5), | ||
commandUtilSweepInterval: z.number().default(3e5), | ||
defaultCooldown: z.number().default(0), | ||
fetchMembers: z.boolean().default(false), | ||
handleEdits: z.boolean().default(false), | ||
allowMention: z.union([z.boolean(), MentionPrefixPredicate]).optional(), | ||
argumentDefaults: DefaultArgumentOptions.optional(), | ||
autoDefer: z.boolean().optional(), | ||
autoRegisterSlashCommands: z.boolean().optional(), | ||
blockBots: z.boolean().optional(), | ||
blockClient: z.boolean().optional(), | ||
commandUtil: z.boolean().optional(), | ||
commandUtilLifetime: z.number().optional(), | ||
commandUtilSweepInterval: z.number().optional(), | ||
defaultCooldown: z.number().optional(), | ||
fetchMembers: z.boolean().optional(), | ||
handleEdits: z.boolean().optional(), | ||
ignoreCooldown: z.union([ArrayOrNot(z.string()), IgnoreCheckPredicate]).optional(), | ||
ignorePermissions: z.union([ArrayOrNot(z.string()), IgnoreCheckPredicate]).default([]), | ||
prefix: z.union([ArrayOrNot(z.string()), PrefixSupplier]).default("!"), | ||
storeMessages: z.boolean().default(false), | ||
typing: z.boolean().default(false), | ||
execSlash: z.boolean().default(false), | ||
skipBuiltInPostInhibitors: z.boolean().default(false) | ||
}); | ||
ignorePermissions: z.union([ArrayOrNot(z.string()), IgnoreCheckPredicate]).optional(), | ||
prefix: z.union([ArrayOrNot(z.string()), PrefixSupplier]).optional(), | ||
storeMessages: z.boolean().optional(), | ||
typing: z.boolean().optional(), | ||
execSlash: z.boolean().optional(), | ||
skipBuiltInPostInhibitors: z.boolean().optional() | ||
}).passthrough(); | ||
@@ -1719,13 +1722,13 @@ /** | ||
export const SlashResolveType = z.union([ | ||
z.literal("Attachment"), | ||
z.literal("Boolean"), | ||
z.literal("Channel"), | ||
z.literal("Integer"), | ||
z.literal("Member"), | ||
z.literal("Mentionable"), | ||
z.literal("Number"), | ||
z.literal("Role"), | ||
z.literal("String"), | ||
z.literal("User") | ||
export const SlashResolveType = z.enum([ | ||
"Attachment", | ||
"Boolean", | ||
"Channel", | ||
"Integer", | ||
"Member", | ||
"Mentionable", | ||
"Number", | ||
"Role", | ||
"String", | ||
"User" | ||
]); | ||
@@ -1732,0 +1735,0 @@ |
@@ -70,4 +70,6 @@ import { z } from "zod"; | ||
z.string().parse(content); | ||
const { flagWords, optionFlagWords, quoted, separator } = ContentParserOptions.parse(options); | ||
ContentParserOptions.parse(options); | ||
const { flagWords = [], optionFlagWords = [], quoted = true, separator } = options; | ||
this.content = content; | ||
@@ -261,13 +263,3 @@ this.flagWords = flagWords; | ||
type TokenType = "FlagWord" | "OptionFlagWord" | "Quote" | "OpenQuote" | "EndQuote" | "Word" | "WS" | "EOF" | "Separator"; | ||
const TokenType = z.union([ | ||
z.literal("FlagWord"), | ||
z.literal("OptionFlagWord"), | ||
z.literal("Quote"), | ||
z.literal("OpenQuote"), | ||
z.literal("EndQuote"), | ||
z.literal("Word"), | ||
z.literal("WS"), | ||
z.literal("EOF"), | ||
z.literal("Separator") | ||
]); | ||
const TokenType = z.enum(["FlagWord", "OptionFlagWord", "Quote", "OpenQuote", "EndQuote", "Word", "WS", "EOF", "Separator"]); | ||
@@ -278,6 +270,8 @@ type Token = { | ||
}; | ||
const Token = z.object({ | ||
type: TokenType, | ||
value: z.string() | ||
}); | ||
const Token = z | ||
.object({ | ||
type: TokenType, | ||
value: z.string() | ||
}) | ||
.passthrough(); | ||
@@ -307,4 +301,6 @@ const enum TokenizerState { | ||
Token.array().parse(tokens); | ||
const { separated } = ParserOptions.parse(options); | ||
ParserOptions.parse(options); | ||
const { separated } = options; | ||
this.tokens = tokens; | ||
@@ -485,5 +481,7 @@ this.separated = separated; | ||
}; | ||
export const ParserOptions = z.object({ | ||
separated: z.boolean() | ||
}); | ||
export const ParserOptions = z | ||
.object({ | ||
separated: z.boolean() | ||
}) | ||
.passthrough(); | ||
@@ -519,4 +517,6 @@ /** | ||
public constructor(options: ContentParserOptions = {}) { | ||
const { flagWords, optionFlagWords, quoted, separator } = ContentParserOptions.parse(options); | ||
ContentParserOptions.parse(options); | ||
const { flagWords = [], optionFlagWords = [], quoted = true, separator } = options; | ||
this.flagWords = flagWords.sort((a, b) => b.length - a.length); | ||
@@ -595,8 +595,10 @@ this.optionFlagWords = optionFlagWords.sort((a, b) => b.length - a.length); | ||
}; | ||
export const ContentParserOptions = z.object({ | ||
flagWords: z.string().array().default([]), | ||
optionFlagWords: z.string().array().default([]), | ||
quoted: z.boolean().default(true), | ||
separator: z.string().optional() | ||
}); | ||
export const ContentParserOptions = z | ||
.object({ | ||
flagWords: z.string().array().optional(), | ||
optionFlagWords: z.string().array().optional(), | ||
quoted: z.boolean().optional(), | ||
separator: z.string().optional() | ||
}) | ||
.passthrough(); | ||
@@ -614,6 +616,8 @@ type BaseParsed = { | ||
}; | ||
const BaseParsed = z.object({ | ||
// type is implemented independently | ||
raw: z.string() | ||
}); | ||
const BaseParsed = z | ||
.object({ | ||
// type is implemented independently | ||
raw: z.string() | ||
}) | ||
.passthrough(); | ||
@@ -634,3 +638,3 @@ /** | ||
value: z.string() | ||
}); | ||
}).passthrough(); | ||
@@ -651,3 +655,3 @@ /** | ||
key: z.string() | ||
}); | ||
}).passthrough(); | ||
@@ -674,3 +678,3 @@ /** | ||
value: z.string() | ||
}); | ||
}).passthrough(); | ||
@@ -691,6 +695,8 @@ /** | ||
}; | ||
export const ExtractedFlags = z.object({ | ||
flagWords: z.string().array(), | ||
optionFlagWords: z.string().array() | ||
}); | ||
export const ExtractedFlags = z | ||
.object({ | ||
flagWords: z.string().array(), | ||
optionFlagWords: z.string().array() | ||
}) | ||
.passthrough(); | ||
@@ -721,7 +727,9 @@ /** | ||
}; | ||
export const ContentParserResult = z.object({ | ||
all: z.union([ParsedPhrase, ParsedFlag, ParsedOptionFlag]).array(), | ||
phrases: ParsedPhrase.array(), | ||
flags: ParsedFlag.array(), | ||
optionFlags: ParsedOptionFlag.array() | ||
}); | ||
export const ContentParserResult = z | ||
.object({ | ||
all: z.union([ParsedPhrase, ParsedFlag, ParsedOptionFlag]).array(), | ||
phrases: ParsedPhrase.array(), | ||
flags: ParsedFlag.array(), | ||
optionFlags: ParsedOptionFlag.array() | ||
}) | ||
.passthrough(); |
@@ -66,6 +66,16 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
public constructor(id: string, options: ContextMenuCommandOptions) { | ||
// eslint-disable-next-line prefer-const | ||
let { category, guilds, name, ownerOnly, superUserOnly, type, nameLocalizations, defaultMemberPermissions, dmPermission } = | ||
ContextMenuCommandOptions.parse(options); | ||
ContextMenuCommandOptions.parse(options); | ||
const { | ||
category, | ||
guilds = [], | ||
name, | ||
ownerOnly = false, | ||
superUserOnly = false, | ||
type, | ||
nameLocalizations, | ||
defaultMemberPermissions | ||
} = options; | ||
let { dmPermission } = options; | ||
if (dmPermission != null && guilds.length > 0) | ||
@@ -148,6 +158,6 @@ throw new TypeError("You cannot set `options.dmPermission` with commands configured with `options.guilds`."); | ||
export const ContextMenuCommandOptions = AkairoModuleOptions.extend({ | ||
guilds: z.string().array().default([]), | ||
guilds: z.string().array().optional(), | ||
name: z.string(), | ||
ownerOnly: z.boolean().default(false), | ||
superUserOnly: z.boolean().default(false), | ||
ownerOnly: z.boolean().optional(), | ||
superUserOnly: z.boolean().optional(), | ||
type: z.union([z.literal(ApplicationCommandType.User), z.literal(ApplicationCommandType.Message)]), | ||
@@ -154,0 +164,0 @@ nameLocalizations: z.record(z.string().nullish()).optional(), |
@@ -34,4 +34,6 @@ import type { Message } from "discord.js"; | ||
public constructor(id: string, options: InhibitorOptions = {}) { | ||
const { category, reason, type, priority } = InhibitorOptions.parse(options); | ||
InhibitorOptions.parse(options); | ||
const { category, reason = "", type = "post", priority = 0 } = options; | ||
super(id, { category }); | ||
@@ -82,5 +84,5 @@ | ||
export const InhibitorOptions = AkairoModuleOptions.extend({ | ||
reason: z.string().default(""), | ||
type: z.enum(["all", "pre", "post"] as const).default("post"), | ||
priority: z.number().default(0) | ||
reason: z.string().optional(), | ||
type: z.enum(["all", "pre", "post"] as const).optional(), | ||
priority: z.number().optional() | ||
}).passthrough(); |
@@ -31,3 +31,5 @@ import EventEmitter from "node:events"; | ||
public constructor(id: string, options: ListenerOptions) { | ||
const { category, emitter, event, type } = ListenerOptions.parse(options); | ||
ListenerOptions.parse(options); | ||
const { category, emitter, event, type = "on" } = options; | ||
super(id, { category }); | ||
@@ -50,8 +52,3 @@ | ||
export type ListenerType = "on" | "once" | "prependListener" | "prependOnceListener"; | ||
export const ListenerType = z.union([ | ||
z.literal("on"), | ||
z.literal("once"), | ||
z.literal("prependListener"), | ||
z.literal("prependOnceListener") | ||
]); | ||
export const ListenerType = z.enum(["on", "once", "prependListener", "prependOnceListener"]); | ||
@@ -81,3 +78,3 @@ /** | ||
event: z.string(), | ||
type: ListenerType.default("on") | ||
}); | ||
type: ListenerType.optional() | ||
}).passthrough(); |
@@ -26,4 +26,6 @@ /* eslint-disable func-names, @typescript-eslint/no-unused-vars */ | ||
public constructor(id: string, options: TaskOptions = {}) { | ||
const { category, delay, runOnStart } = TaskOptions.parse(options); | ||
TaskOptions.parse(options); | ||
const { category, delay, runOnStart = false } = options; | ||
super(id, { category }); | ||
@@ -61,3 +63,3 @@ this.delay = delay; | ||
delay: z.number().optional(), | ||
runOnStart: z.boolean().default(false) | ||
runOnStart: z.boolean().optional() | ||
}).passthrough(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1083016
17223