commandkit 0.1.11-dev.20250404110151 → 0.1.11-dev.20250405091951
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +59 -28
- package/dist/index.js +94 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -731,6 +731,36 @@ declare function rethrow(error: unknown): void;
|
|
|
731
731
|
*/
|
|
732
732
|
declare function redirect(): never;
|
|
733
733
|
|
|
734
|
+
interface PreRegisterCommandsEvent {
|
|
735
|
+
preventDefault(): void;
|
|
736
|
+
commands: CommandData[];
|
|
737
|
+
}
|
|
738
|
+
declare class CommandRegistrar {
|
|
739
|
+
readonly commandkit: CommandKit;
|
|
740
|
+
private api;
|
|
741
|
+
/**
|
|
742
|
+
* Creates an instance of CommandRegistrar.
|
|
743
|
+
* @param commandkit The commandkit instance.
|
|
744
|
+
*/
|
|
745
|
+
constructor(commandkit: CommandKit);
|
|
746
|
+
/**
|
|
747
|
+
* Gets the commands data.
|
|
748
|
+
*/
|
|
749
|
+
getCommandsData(): CommandData[];
|
|
750
|
+
/**
|
|
751
|
+
* Registers loaded commands.
|
|
752
|
+
*/
|
|
753
|
+
register(): Promise<void>;
|
|
754
|
+
/**
|
|
755
|
+
* Updates the global commands.
|
|
756
|
+
*/
|
|
757
|
+
updateGlobalCommands(commands: CommandData[]): Promise<void>;
|
|
758
|
+
/**
|
|
759
|
+
* Updates the guild commands.
|
|
760
|
+
*/
|
|
761
|
+
updateGuildCommands(commands: CommandData[]): Promise<void>;
|
|
762
|
+
}
|
|
763
|
+
|
|
734
764
|
type CommandSource = Interaction | Message$1;
|
|
735
765
|
declare function isMessageSource(source: CommandSource): source is Message$1;
|
|
736
766
|
declare function isInteractionSource(source: CommandSource): source is Interaction;
|
|
@@ -1035,32 +1065,6 @@ declare class MiddlewareContext<T extends CommandExecutionMode = CommandExecutio
|
|
|
1035
1065
|
setCommandRunner(fn: RunCommand): void;
|
|
1036
1066
|
}
|
|
1037
1067
|
|
|
1038
|
-
declare class CommandRegistrar {
|
|
1039
|
-
readonly commandkit: CommandKit;
|
|
1040
|
-
private api;
|
|
1041
|
-
/**
|
|
1042
|
-
* Creates an instance of CommandRegistrar.
|
|
1043
|
-
* @param commandkit The commandkit instance.
|
|
1044
|
-
*/
|
|
1045
|
-
constructor(commandkit: CommandKit);
|
|
1046
|
-
/**
|
|
1047
|
-
* Gets the commands data.
|
|
1048
|
-
*/
|
|
1049
|
-
getCommandsData(): CommandData[];
|
|
1050
|
-
/**
|
|
1051
|
-
* Registers loaded commands.
|
|
1052
|
-
*/
|
|
1053
|
-
register(): Promise<void>;
|
|
1054
|
-
/**
|
|
1055
|
-
* Updates the global commands.
|
|
1056
|
-
*/
|
|
1057
|
-
updateGlobalCommands(commands: CommandData[]): Promise<void>;
|
|
1058
|
-
/**
|
|
1059
|
-
* Updates the guild commands.
|
|
1060
|
-
*/
|
|
1061
|
-
updateGuildCommands(commands: CommandData[]): Promise<void>;
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
1068
|
declare class MemoryCache extends CacheProvider {
|
|
1065
1069
|
#private;
|
|
1066
1070
|
get<T>(key: string): Promise<CacheEntry<T> | undefined>;
|
|
@@ -1664,6 +1668,33 @@ declare abstract class RuntimePlugin<T extends PluginOptions = PluginOptions> ex
|
|
|
1664
1668
|
* @param commands The command that is being loaded. This is a CommandBuilderLike object which represents Discord's command
|
|
1665
1669
|
*/
|
|
1666
1670
|
prepareCommand(ctx: CommandKitPluginRuntime, commands: CommandBuilderLike): Promise<CommandBuilderLike | null>;
|
|
1671
|
+
/**
|
|
1672
|
+
* Called before command is registered to discord. This method can cancel the registration of the command and handle it manually.
|
|
1673
|
+
* @param ctx The context
|
|
1674
|
+
* @param data The command registration data
|
|
1675
|
+
*/
|
|
1676
|
+
onBeforeRegisterCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
1677
|
+
/**
|
|
1678
|
+
* Called before global commands registration. This method can cancel the registration of the command and handle it manually.
|
|
1679
|
+
* This method is called after `onBeforeRegisterCommands` if that stage was not handled.
|
|
1680
|
+
* @param ctx The context
|
|
1681
|
+
* @param event The command registration data
|
|
1682
|
+
*/
|
|
1683
|
+
onBeforeRegisterGlobalCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
1684
|
+
/**
|
|
1685
|
+
* Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
|
|
1686
|
+
* This method is called before guilds of the command are resolved. It is called after `onBeforeRegisterCommands` if that stage was not handled.
|
|
1687
|
+
* @param ctx The context
|
|
1688
|
+
* @param event The command registration data
|
|
1689
|
+
*/
|
|
1690
|
+
onBeforePrepareGuildCommandsRegistration(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
1691
|
+
/**
|
|
1692
|
+
* Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
|
|
1693
|
+
* This method is called after guilds of the command are resolved. It is called after `onBeforePrepareGuildCommandsRegistration` if that stage was not handled.
|
|
1694
|
+
* @param ctx The context
|
|
1695
|
+
* @param event The command registration data
|
|
1696
|
+
*/
|
|
1697
|
+
onBeforeRegisterGuildCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
1667
1698
|
}
|
|
1668
1699
|
declare function isRuntimePlugin(plugin: unknown): plugin is RuntimePlugin;
|
|
1669
1700
|
|
|
@@ -1772,7 +1803,7 @@ interface CommandKitConfig {
|
|
|
1772
1803
|
/**
|
|
1773
1804
|
* The plugins to use with CommandKit.
|
|
1774
1805
|
*/
|
|
1775
|
-
plugins?: CommandKitPlugin[]
|
|
1806
|
+
plugins?: MaybeArray<CommandKitPlugin[]>;
|
|
1776
1807
|
/**
|
|
1777
1808
|
* The esbuild plugins to use with CommandKit.
|
|
1778
1809
|
*/
|
|
@@ -1938,4 +1969,4 @@ declare function devOnly<T extends (...args: any[]) => any>(fn: T): T;
|
|
|
1938
1969
|
*/
|
|
1939
1970
|
declare function bootstrapCommandkitCLI(argv: string[], options?: commander.ParseOptions | undefined): Promise<void>;
|
|
1940
1971
|
|
|
1941
|
-
export { ActionRow, type ActionRowProps, type AnyCommandExecute, type AnyCommandKitElement, AppCommandHandler, type AsyncFunction, type AutocompleteCommand, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, COMMANDKIT_CACHE_TAG, COMMANDKIT_IS_DEV, COMMANDKIT_IS_TEST, type CacheContext, type CacheEntry, type CacheMetadata, CacheProvider, ChannelSelectMenu, ChannelSelectMenuKit, type ChannelSelectMenuKitPredicate, type ChannelSelectMenuProps, type Command, type CommandBuilderLike, type CommandContext, type CommandContextOptions, type CommandData, CommandExecutionMode, CommandKit, type CommandKitButtonBuilderInteractionCollectorDispatch, type CommandKitButtonBuilderInteractionCollectorDispatchContextData, type CommandKitButtonBuilderOnEnd, type CommandKitConfiguration, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitHMREvent, type CommandKitLoggerOptions, type CommandKitModalBuilderInteractionCollectorDispatch, type CommandKitModalBuilderInteractionCollectorDispatchContextData, type CommandKitModalBuilderOnEnd, type CommandKitOptions, type CommandKitPlugin, CommandKitPluginRuntime, type CommandKitSelectMenuBuilderInteractionCollectorDispatch, type CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData, type CommandKitSelectMenuBuilderOnEnd, type CommandSource, type CommandTypeData, CommandsRouter, type CommandsRouterOptions, type CommonBuilderKit, type CommonPluginRuntime, type CommonSelectMenuProps, CompilerPlugin, CompilerPluginRuntime, Context, type ContextParameters, DefaultLogger, ElementType, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, EventsRouter, type EventsRouterOptions, type EventsTree, Fragment, type FragmentElementProps, type GenericFunction, HMREventType, type ILogger, type InteractionCommandContext, type InteractionCommandMiddlewareContext, type LoadedCommand, type Loader, type Location, Logger, type LoggerImpl, type MaybeArray, type MaybeFalsey, MemoryCache, MentionableSelectMenu, MentionableSelectMenuKit, type MentionableSelectMenuKitPredicate, type MentionableSelectMenuProps, type Message, type MessageCommand, type MessageCommandContext, type MessageCommandMiddlewareContext, MessageCommandOptions, type MessageCommandOptionsSchema, MessageCommandParser, type MessageContextMenuCommand, type MessageContextMenuCommandContext, type MessageContextMenuCommandMiddlewareContext, type Middleware, MiddlewareContext, type MiddlewareContextArgs, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnChannelSelectMenuKitSubmit, type OnLoadArgs, type OnLoadOptions, type OnLoadResult, type OnMentionableSelectMenuKitSubmit, type OnModalKitEnd, type OnModalKitSubmit, type OnResolveArgs, type OnResolveOptions, type OnResolveResult, type OnRoleSelectMenuKitSubmit, type OnSelectMenuKitEnd, type OnSelectMenuKitSubmit, type OnStringSelectMenuKitSubmit, type OnUserSelectMenuKitSubmit, ParagraphInput, type ParsedCommandData, type ParsedEvent, type ParsedMessageCommand, type PluginTransformParameters, type PreparedAppCommandExecution, type ResolvableCommand, type ResolveBuilderInteraction, type ResolveKind, type ResolveResult, RoleSelectMenu, RoleSelectMenuKit, type RoleSelectMenuKitPredicate, type RoleSelectMenuProps, type RunCommand, RuntimePlugin, type SelectMenuKitPredicate, type SelectMenuProps, type Setup, ShortInput, type SlashCommand, type SlashCommandContext, type SlashCommandMiddlewareContext, StringSelectMenu, StringSelectMenuKit, type StringSelectMenuKitPredicate, StringSelectMenuOption, type StringSelectMenuOptionProps, type StringSelectMenuProps, TextInput, type TextInputProps, type TransformedResult, type UserContextMenuCommand, type UserContextMenuCommandContext, type UserContextMenuCommandMiddlewareContext, UserSelectMenu, UserSelectMenuKit, type UserSelectMenuKitPredicate, type UserSelectMenuProps, afterCommand, bootstrapCommandkitCLI, cache, cacheLife, cacheTag, cancelAfterCommand, commandkit, createElement, createLogger, debounce, CommandKit as default, defineConfig, devOnly, exitContext, exitMiddleware, fromEsbuildPlugin, getCommandKit, getConfig, getContext, getCurrentDirectory, getElement, getSourceDirectories, invalidate, isCachedFunction, isCommandKitElement, isCompilerPlugin, isInteractionSource, isMessageSource, isRuntimePlugin, makeContextAwareFunction, provideContext, redirect, rethrow, revalidate, useEnvironment, version, zzz_commandkit_secret_internal_use_cache_wrapper_do_not_use_or_you_will_be_fired };
|
|
1972
|
+
export { ActionRow, type ActionRowProps, type AnyCommandExecute, type AnyCommandKitElement, AppCommandHandler, type AsyncFunction, type AutocompleteCommand, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, COMMANDKIT_CACHE_TAG, COMMANDKIT_IS_DEV, COMMANDKIT_IS_TEST, type CacheContext, type CacheEntry, type CacheMetadata, CacheProvider, ChannelSelectMenu, ChannelSelectMenuKit, type ChannelSelectMenuKitPredicate, type ChannelSelectMenuProps, type Command, type CommandBuilderLike, type CommandContext, type CommandContextOptions, type CommandData, CommandExecutionMode, CommandKit, type CommandKitButtonBuilderInteractionCollectorDispatch, type CommandKitButtonBuilderInteractionCollectorDispatchContextData, type CommandKitButtonBuilderOnEnd, type CommandKitConfiguration, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitHMREvent, type CommandKitLoggerOptions, type CommandKitModalBuilderInteractionCollectorDispatch, type CommandKitModalBuilderInteractionCollectorDispatchContextData, type CommandKitModalBuilderOnEnd, type CommandKitOptions, type CommandKitPlugin, CommandKitPluginRuntime, type CommandKitSelectMenuBuilderInteractionCollectorDispatch, type CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData, type CommandKitSelectMenuBuilderOnEnd, CommandRegistrar, type CommandSource, type CommandTypeData, CommandsRouter, type CommandsRouterOptions, type CommonBuilderKit, type CommonPluginRuntime, type CommonSelectMenuProps, CompilerPlugin, CompilerPluginRuntime, Context, type ContextParameters, DefaultLogger, ElementType, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, EventsRouter, type EventsRouterOptions, type EventsTree, Fragment, type FragmentElementProps, type GenericFunction, HMREventType, type ILogger, type InteractionCommandContext, type InteractionCommandMiddlewareContext, type LoadedCommand, type Loader, type Location, Logger, type LoggerImpl, type MaybeArray, type MaybeFalsey, MemoryCache, MentionableSelectMenu, MentionableSelectMenuKit, type MentionableSelectMenuKitPredicate, type MentionableSelectMenuProps, type Message, type MessageCommand, type MessageCommandContext, type MessageCommandMiddlewareContext, MessageCommandOptions, type MessageCommandOptionsSchema, MessageCommandParser, type MessageContextMenuCommand, type MessageContextMenuCommandContext, type MessageContextMenuCommandMiddlewareContext, type Middleware, MiddlewareContext, type MiddlewareContextArgs, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnChannelSelectMenuKitSubmit, type OnLoadArgs, type OnLoadOptions, type OnLoadResult, type OnMentionableSelectMenuKitSubmit, type OnModalKitEnd, type OnModalKitSubmit, type OnResolveArgs, type OnResolveOptions, type OnResolveResult, type OnRoleSelectMenuKitSubmit, type OnSelectMenuKitEnd, type OnSelectMenuKitSubmit, type OnStringSelectMenuKitSubmit, type OnUserSelectMenuKitSubmit, ParagraphInput, type ParsedCommandData, type ParsedEvent, type ParsedMessageCommand, type PluginTransformParameters, type PreRegisterCommandsEvent, type PreparedAppCommandExecution, type ResolvableCommand, type ResolveBuilderInteraction, type ResolveKind, type ResolveResult, RoleSelectMenu, RoleSelectMenuKit, type RoleSelectMenuKitPredicate, type RoleSelectMenuProps, type RunCommand, RuntimePlugin, type SelectMenuKitPredicate, type SelectMenuProps, type Setup, ShortInput, type SlashCommand, type SlashCommandContext, type SlashCommandMiddlewareContext, StringSelectMenu, StringSelectMenuKit, type StringSelectMenuKitPredicate, StringSelectMenuOption, type StringSelectMenuOptionProps, type StringSelectMenuProps, TextInput, type TextInputProps, type TransformedResult, type UserContextMenuCommand, type UserContextMenuCommandContext, type UserContextMenuCommandMiddlewareContext, UserSelectMenu, UserSelectMenuKit, type UserSelectMenuKitPredicate, type UserSelectMenuProps, afterCommand, bootstrapCommandkitCLI, cache, cacheLife, cacheTag, cancelAfterCommand, commandkit, createElement, createLogger, debounce, CommandKit as default, defineConfig, devOnly, exitContext, exitMiddleware, fromEsbuildPlugin, getCommandKit, getConfig, getContext, getCurrentDirectory, getElement, getSourceDirectories, invalidate, isCachedFunction, isCommandKitElement, isCompilerPlugin, isInteractionSource, isMessageSource, isRuntimePlugin, makeContextAwareFunction, provideContext, redirect, rethrow, revalidate, useEnvironment, version, zzz_commandkit_secret_internal_use_cache_wrapper_do_not_use_or_you_will_be_fired };
|
package/dist/index.js
CHANGED
|
@@ -2053,6 +2053,37 @@ var init_RuntimePlugin = __esm({
|
|
|
2053
2053
|
async prepareCommand(ctx, commands) {
|
|
2054
2054
|
return null;
|
|
2055
2055
|
}
|
|
2056
|
+
/**
|
|
2057
|
+
* Called before command is registered to discord. This method can cancel the registration of the command and handle it manually.
|
|
2058
|
+
* @param ctx The context
|
|
2059
|
+
* @param data The command registration data
|
|
2060
|
+
*/
|
|
2061
|
+
async onBeforeRegisterCommands(ctx, event) {
|
|
2062
|
+
}
|
|
2063
|
+
/**
|
|
2064
|
+
* Called before global commands registration. This method can cancel the registration of the command and handle it manually.
|
|
2065
|
+
* This method is called after `onBeforeRegisterCommands` if that stage was not handled.
|
|
2066
|
+
* @param ctx The context
|
|
2067
|
+
* @param event The command registration data
|
|
2068
|
+
*/
|
|
2069
|
+
async onBeforeRegisterGlobalCommands(ctx, event) {
|
|
2070
|
+
}
|
|
2071
|
+
/**
|
|
2072
|
+
* Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
|
|
2073
|
+
* This method is called before guilds of the command are resolved. It is called after `onBeforeRegisterCommands` if that stage was not handled.
|
|
2074
|
+
* @param ctx The context
|
|
2075
|
+
* @param event The command registration data
|
|
2076
|
+
*/
|
|
2077
|
+
async onBeforePrepareGuildCommandsRegistration(ctx, event) {
|
|
2078
|
+
}
|
|
2079
|
+
/**
|
|
2080
|
+
* Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
|
|
2081
|
+
* This method is called after guilds of the command are resolved. It is called after `onBeforePrepareGuildCommandsRegistration` if that stage was not handled.
|
|
2082
|
+
* @param ctx The context
|
|
2083
|
+
* @param event The command registration data
|
|
2084
|
+
*/
|
|
2085
|
+
async onBeforeRegisterGuildCommands(ctx, event) {
|
|
2086
|
+
}
|
|
2056
2087
|
};
|
|
2057
2088
|
__name(_RuntimePlugin, "RuntimePlugin");
|
|
2058
2089
|
RuntimePlugin = _RuntimePlugin;
|
|
@@ -2810,7 +2841,10 @@ function defineConfig(config = {}) {
|
|
|
2810
2841
|
...config.esbuildPlugins ?? [],
|
|
2811
2842
|
...defaultConfig.esbuildPlugins ?? []
|
|
2812
2843
|
],
|
|
2813
|
-
plugins: [
|
|
2844
|
+
plugins: [
|
|
2845
|
+
...config.plugins ?? [],
|
|
2846
|
+
...defaultConfig.plugins ?? []
|
|
2847
|
+
],
|
|
2814
2848
|
sourceMap: {
|
|
2815
2849
|
...defaultConfig.sourceMap,
|
|
2816
2850
|
...config.sourceMap
|
|
@@ -3201,10 +3235,22 @@ var init_CommandRegistrar = __esm({
|
|
|
3201
3235
|
* Registers loaded commands.
|
|
3202
3236
|
*/
|
|
3203
3237
|
async register() {
|
|
3238
|
+
const commands = this.getCommandsData();
|
|
3239
|
+
let preRegistrationPrevented = false;
|
|
3240
|
+
const preRegisterEvent = {
|
|
3241
|
+
preventDefault() {
|
|
3242
|
+
preRegistrationPrevented = true;
|
|
3243
|
+
},
|
|
3244
|
+
commands
|
|
3245
|
+
};
|
|
3246
|
+
await this.commandkit.plugins.execute(async (ctx, plugin) => {
|
|
3247
|
+
if (preRegistrationPrevented) return;
|
|
3248
|
+
return plugin.onBeforeRegisterCommands(ctx, preRegisterEvent);
|
|
3249
|
+
});
|
|
3250
|
+
if (preRegistrationPrevented) return;
|
|
3204
3251
|
if (!this.commandkit.client.isReady()) {
|
|
3205
3252
|
throw new Error("Cannot register commands before the client is ready");
|
|
3206
3253
|
}
|
|
3207
|
-
const commands = this.getCommandsData();
|
|
3208
3254
|
const guildCommands = commands.filter((command) => {
|
|
3209
3255
|
var _a;
|
|
3210
3256
|
return (_a = command.guilds) == null ? void 0 : _a.filter(Boolean).length;
|
|
@@ -3229,6 +3275,17 @@ var init_CommandRegistrar = __esm({
|
|
|
3229
3275
|
*/
|
|
3230
3276
|
async updateGlobalCommands(commands) {
|
|
3231
3277
|
if (!commands.length) return;
|
|
3278
|
+
let prevented = false;
|
|
3279
|
+
const preRegisterEvent = {
|
|
3280
|
+
preventDefault() {
|
|
3281
|
+
prevented = true;
|
|
3282
|
+
},
|
|
3283
|
+
commands
|
|
3284
|
+
};
|
|
3285
|
+
await this.commandkit.plugins.execute(async (ctx, plugin) => {
|
|
3286
|
+
if (prevented) return;
|
|
3287
|
+
return plugin.onBeforeRegisterGlobalCommands(ctx, preRegisterEvent);
|
|
3288
|
+
});
|
|
3232
3289
|
try {
|
|
3233
3290
|
const data = await this.api.put(
|
|
3234
3291
|
import_discord14.Routes.applicationCommands(this.commandkit.client.user.id),
|
|
@@ -3250,6 +3307,22 @@ var init_CommandRegistrar = __esm({
|
|
|
3250
3307
|
* Updates the guild commands.
|
|
3251
3308
|
*/
|
|
3252
3309
|
async updateGuildCommands(commands) {
|
|
3310
|
+
if (!commands.length) return;
|
|
3311
|
+
let prevented = false;
|
|
3312
|
+
const preRegisterEvent = {
|
|
3313
|
+
preventDefault() {
|
|
3314
|
+
prevented = true;
|
|
3315
|
+
},
|
|
3316
|
+
commands
|
|
3317
|
+
};
|
|
3318
|
+
await this.commandkit.plugins.execute(async (ctx, plugin) => {
|
|
3319
|
+
if (prevented) return;
|
|
3320
|
+
return plugin.onBeforePrepareGuildCommandsRegistration(
|
|
3321
|
+
ctx,
|
|
3322
|
+
preRegisterEvent
|
|
3323
|
+
);
|
|
3324
|
+
});
|
|
3325
|
+
if (prevented) return;
|
|
3253
3326
|
try {
|
|
3254
3327
|
const guildCommandsMap = /* @__PURE__ */ new Map();
|
|
3255
3328
|
commands.forEach((command) => {
|
|
@@ -3265,6 +3338,18 @@ var init_CommandRegistrar = __esm({
|
|
|
3265
3338
|
if (!guildCommandsMap.size) return;
|
|
3266
3339
|
let count = 0;
|
|
3267
3340
|
for (const [guild, guildCommands] of guildCommandsMap) {
|
|
3341
|
+
let prevented2 = false;
|
|
3342
|
+
const preRegisterEvent2 = {
|
|
3343
|
+
preventDefault() {
|
|
3344
|
+
prevented2 = true;
|
|
3345
|
+
},
|
|
3346
|
+
commands: guildCommands
|
|
3347
|
+
};
|
|
3348
|
+
await this.commandkit.plugins.execute(async (ctx, plugin) => {
|
|
3349
|
+
if (prevented2) return;
|
|
3350
|
+
return plugin.onBeforeRegisterGuildCommands(ctx, preRegisterEvent2);
|
|
3351
|
+
});
|
|
3352
|
+
if (prevented2) continue;
|
|
3268
3353
|
const data = await this.api.put(
|
|
3269
3354
|
import_discord14.Routes.applicationGuildCommands(
|
|
3270
3355
|
this.commandkit.client.user.id,
|
|
@@ -5330,7 +5415,7 @@ var init_CommandKit = __esm({
|
|
|
5330
5415
|
return (_a = plugin.onBeforeClientLogin) == null ? void 0 : _a.call(plugin, ctx);
|
|
5331
5416
|
});
|
|
5332
5417
|
await this.options.client.login(
|
|
5333
|
-
token ?? process.env.TOKEN ?? process.env.DISCORD_TOKEN
|
|
5418
|
+
token ?? this.options.client.token ?? process.env.TOKEN ?? process.env.DISCORD_TOKEN
|
|
5334
5419
|
);
|
|
5335
5420
|
await this.plugins.execute((ctx, plugin) => {
|
|
5336
5421
|
var _a;
|
|
@@ -5346,7 +5431,7 @@ var init_CommandKit = __esm({
|
|
|
5346
5431
|
*/
|
|
5347
5432
|
async loadPlugins() {
|
|
5348
5433
|
const config = await loadConfigFile();
|
|
5349
|
-
const plugins = config.plugins.filter((p) => isRuntimePlugin(p));
|
|
5434
|
+
const plugins = config.plugins.flat(2).filter((p) => isRuntimePlugin(p));
|
|
5350
5435
|
if (!plugins.length) return;
|
|
5351
5436
|
for (const plugin of plugins) {
|
|
5352
5437
|
await this.plugins.softRegisterPlugin(plugin);
|
|
@@ -5510,7 +5595,7 @@ var init_version = __esm({
|
|
|
5510
5595
|
"use strict";
|
|
5511
5596
|
init_cjs_shims();
|
|
5512
5597
|
version = /* @__MACRO__ $version */
|
|
5513
|
-
"0.1.11-dev.
|
|
5598
|
+
"0.1.11-dev.20250405091951";
|
|
5514
5599
|
}
|
|
5515
5600
|
});
|
|
5516
5601
|
|
|
@@ -5861,7 +5946,7 @@ async function buildAndStart(configPath, skipStart = false) {
|
|
|
5861
5946
|
await buildApplication({
|
|
5862
5947
|
configPath,
|
|
5863
5948
|
isDev: true,
|
|
5864
|
-
plugins: config.plugins.filter((p) => isCompilerPlugin(p)),
|
|
5949
|
+
plugins: config.plugins.flat(2).filter((p) => isCompilerPlugin(p)),
|
|
5865
5950
|
esbuildPlugins: config.esbuildPlugins
|
|
5866
5951
|
});
|
|
5867
5952
|
if (skipStart) return null;
|
|
@@ -6389,6 +6474,7 @@ __export(index_exports, {
|
|
|
6389
6474
|
CommandKitEnvironment: () => CommandKitEnvironment,
|
|
6390
6475
|
CommandKitEnvironmentType: () => CommandKitEnvironmentType,
|
|
6391
6476
|
CommandKitPluginRuntime: () => CommandKitPluginRuntime,
|
|
6477
|
+
CommandRegistrar: () => CommandRegistrar,
|
|
6392
6478
|
CommandsRouter: () => CommandsRouter,
|
|
6393
6479
|
CompilerPlugin: () => CompilerPlugin,
|
|
6394
6480
|
CompilerPluginRuntime: () => CompilerPluginRuntime,
|
|
@@ -6473,6 +6559,7 @@ init_AppCommandHandler();
|
|
|
6473
6559
|
init_Context();
|
|
6474
6560
|
init_MessageCommandParser();
|
|
6475
6561
|
init_signals();
|
|
6562
|
+
init_CommandRegistrar();
|
|
6476
6563
|
|
|
6477
6564
|
// src/app/commands/helpers.ts
|
|
6478
6565
|
init_cjs_shims();
|
|
@@ -6574,6 +6661,7 @@ var index_default = CommandKit;
|
|
|
6574
6661
|
CommandKitEnvironment,
|
|
6575
6662
|
CommandKitEnvironmentType,
|
|
6576
6663
|
CommandKitPluginRuntime,
|
|
6664
|
+
CommandRegistrar,
|
|
6577
6665
|
CommandsRouter,
|
|
6578
6666
|
CompilerPlugin,
|
|
6579
6667
|
CompilerPluginRuntime,
|