commandkit 1.0.0-dev.20250520020143 → 1.0.0-dev.20250520131642
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/components.cjs +1 -0
- package/components.d.ts +1 -0
- package/config.cjs +5 -0
- package/config.d.ts +1 -0
- package/dist/CommandKit-jZCy9fZX.d.ts +914 -0
- package/dist/CommandKit.d.ts +13 -0
- package/dist/CommandKit.js +16 -0
- package/dist/CommandKit.js.map +1 -0
- package/dist/app/commands/AppCommandRunner.d.ts +13 -0
- package/dist/app/commands/AppCommandRunner.js +3 -0
- package/dist/app/commands/AppCommandRunner.js.map +1 -0
- package/dist/app/commands/Context.d.ts +13 -0
- package/dist/app/commands/Context.js +3 -0
- package/dist/app/commands/Context.js.map +1 -0
- package/dist/app/commands/MessageCommandParser.d.ts +60 -0
- package/dist/app/commands/MessageCommandParser.js +2 -0
- package/dist/app/commands/MessageCommandParser.js.map +1 -0
- package/dist/app/commands/helpers.d.ts +7 -0
- package/dist/app/commands/helpers.js +2 -0
- package/dist/app/commands/helpers.js.map +1 -0
- package/dist/app/events/EventWorkerContext.d.ts +28 -0
- package/dist/app/events/EventWorkerContext.js +2 -0
- package/dist/app/events/EventWorkerContext.js.map +1 -0
- package/dist/app/handlers/AppCommandHandler.d.ts +13 -0
- package/dist/app/handlers/AppCommandHandler.js +8 -0
- package/dist/app/handlers/AppCommandHandler.js.map +1 -0
- package/dist/app/handlers/AppEventsHandler.d.ts +13 -0
- package/dist/app/handlers/AppEventsHandler.js +3 -0
- package/dist/app/handlers/AppEventsHandler.js.map +1 -0
- package/dist/app/index.d.ts +15 -0
- package/dist/app/index.js +8 -0
- package/dist/app/index.js.map +1 -0
- package/dist/app/middleware/signals.d.ts +18 -0
- package/dist/app/middleware/signals.js +2 -0
- package/dist/app/middleware/signals.js.map +1 -0
- package/dist/app/register/CommandRegistrar.d.ts +13 -0
- package/dist/app/register/CommandRegistrar.js +3 -0
- package/dist/app/register/CommandRegistrar.js.map +1 -0
- package/dist/app/router/CommandsRouter.d.ts +65 -0
- package/dist/app/router/CommandsRouter.js +2 -0
- package/dist/app/router/CommandsRouter.js.map +1 -0
- package/dist/app/router/EventsRouter.d.ts +88 -0
- package/dist/app/router/EventsRouter.js +2 -0
- package/dist/app/router/EventsRouter.js.map +1 -0
- package/dist/app/router/index.d.ts +3 -0
- package/dist/app/router/index.js +2 -0
- package/dist/app/router/index.js.map +1 -0
- package/dist/cli/app-process.d.ts +5 -0
- package/dist/cli/app-process.js +3 -0
- package/dist/cli/app-process.js.map +1 -0
- package/dist/cli/build.d.ts +24 -0
- package/dist/cli/build.js +49 -0
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/common.d.ts +31 -0
- package/dist/cli/common.js +10 -0
- package/dist/cli/common.js.map +1 -0
- package/dist/cli/development.d.ts +3 -0
- package/dist/cli/development.js +55 -0
- package/dist/cli/development.js.map +1 -0
- package/dist/cli/env.d.ts +15 -0
- package/dist/cli/env.js +2 -0
- package/dist/cli/env.js.map +1 -0
- package/dist/cli/generators.d.ts +4 -0
- package/dist/cli/generators.js +42 -0
- package/dist/cli/generators.js.map +1 -0
- package/dist/cli/information.d.ts +3 -0
- package/dist/cli/information.js +7 -0
- package/dist/cli/information.js.map +1 -0
- package/dist/cli/init.d.ts +10 -0
- package/dist/cli/init.js +100 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/parse-env.d.ts +3 -0
- package/dist/cli/parse-env.js +2 -0
- package/dist/cli/parse-env.js.map +1 -0
- package/dist/cli/production.d.ts +6 -0
- package/dist/cli/production.js +50 -0
- package/dist/cli/production.js.map +1 -0
- package/dist/cli/type-checker.d.ts +7 -0
- package/dist/cli/type-checker.js +5 -0
- package/dist/cli/type-checker.js.map +1 -0
- package/dist/cli/utils.d.ts +5 -0
- package/dist/cli/utils.js +2 -0
- package/dist/cli/utils.js.map +1 -0
- package/dist/components/common/EventInterceptor.d.ts +82 -0
- package/dist/components/common/EventInterceptor.js +2 -0
- package/dist/components/common/EventInterceptor.js.map +1 -0
- package/dist/components/common/element.d.ts +29 -0
- package/dist/components/common/element.js +2 -0
- package/dist/components/common/element.js.map +1 -0
- package/dist/components/common/types.d.ts +3 -0
- package/dist/components/common/types.js +2 -0
- package/dist/components/common/types.js.map +1 -0
- package/dist/components/index.d.ts +22 -0
- package/dist/components/index.js +16 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/v1/action-row/ActionRow.d.ts +18 -0
- package/dist/components/v1/action-row/ActionRow.js +2 -0
- package/dist/components/v1/action-row/ActionRow.js.map +1 -0
- package/dist/components/v1/button/Button.d.ts +31 -0
- package/dist/components/v1/button/Button.js +16 -0
- package/dist/components/v1/button/Button.js.map +1 -0
- package/dist/components/v1/button/ButtonKit.d.ts +66 -0
- package/dist/components/v1/button/ButtonKit.js +16 -0
- package/dist/components/v1/button/ButtonKit.js.map +1 -0
- package/dist/components/v1/modal/Modal.d.ts +57 -0
- package/dist/components/v1/modal/Modal.js +16 -0
- package/dist/components/v1/modal/Modal.js.map +1 -0
- package/dist/components/v1/modal/ModalKit.d.ts +64 -0
- package/dist/components/v1/modal/ModalKit.js +16 -0
- package/dist/components/v1/modal/ModalKit.js.map +1 -0
- package/dist/components/v1/select-menu/ChannelSelectMenuKit.d.ts +49 -0
- package/dist/components/v1/select-menu/ChannelSelectMenuKit.js +16 -0
- package/dist/components/v1/select-menu/ChannelSelectMenuKit.js.map +1 -0
- package/dist/components/v1/select-menu/MentionableSelectMenuKit.d.ts +49 -0
- package/dist/components/v1/select-menu/MentionableSelectMenuKit.js +16 -0
- package/dist/components/v1/select-menu/MentionableSelectMenuKit.js.map +1 -0
- package/dist/components/v1/select-menu/RoleSelectMenuKit.d.ts +49 -0
- package/dist/components/v1/select-menu/RoleSelectMenuKit.js +16 -0
- package/dist/components/v1/select-menu/RoleSelectMenuKit.js.map +1 -0
- package/dist/components/v1/select-menu/SelectMenu.d.ts +40 -0
- package/dist/components/v1/select-menu/SelectMenu.js +16 -0
- package/dist/components/v1/select-menu/SelectMenu.js.map +1 -0
- package/dist/components/v1/select-menu/StringSelectMenuKit.d.ts +49 -0
- package/dist/components/v1/select-menu/StringSelectMenuKit.js +16 -0
- package/dist/components/v1/select-menu/StringSelectMenuKit.js.map +1 -0
- package/dist/components/v1/select-menu/UserSelectMenuKit.d.ts +49 -0
- package/dist/components/v1/select-menu/UserSelectMenuKit.js +16 -0
- package/dist/components/v1/select-menu/UserSelectMenuKit.js.map +1 -0
- package/dist/components/v1/select-menu/common.d.ts +23 -0
- package/dist/components/v1/select-menu/common.js +2 -0
- package/dist/components/v1/select-menu/common.js.map +1 -0
- package/dist/components/v2/common.d.ts +7 -0
- package/dist/components/v2/common.js +2 -0
- package/dist/components/v2/common.js.map +1 -0
- package/dist/components/v2/container.d.ts +8 -0
- package/dist/components/v2/container.js +2 -0
- package/dist/components/v2/container.js.map +1 -0
- package/dist/components/v2/file.d.ts +8 -0
- package/dist/components/v2/file.js +2 -0
- package/dist/components/v2/file.js.map +1 -0
- package/dist/components/v2/index.d.ts +7 -0
- package/dist/components/v2/index.js +2 -0
- package/dist/components/v2/index.js.map +1 -0
- package/dist/components/v2/media-gallery.d.ts +15 -0
- package/dist/components/v2/media-gallery.js +2 -0
- package/dist/components/v2/media-gallery.js.map +1 -0
- package/dist/components/v2/section.d.ts +16 -0
- package/dist/components/v2/section.js +2 -0
- package/dist/components/v2/section.js.map +1 -0
- package/dist/components/v2/separator.d.ts +7 -0
- package/dist/components/v2/separator.js +2 -0
- package/dist/components/v2/separator.js.map +1 -0
- package/dist/components/v2/text-display.d.ts +10 -0
- package/dist/components/v2/text-display.js +2 -0
- package/dist/components/v2/text-display.js.map +1 -0
- package/dist/config/config.d.ts +28 -0
- package/dist/config/config.js +3 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/default.d.ts +20 -0
- package/dist/config/default.js +3 -0
- package/dist/config/default.js.map +1 -0
- package/dist/config/loader.d.ts +25 -0
- package/dist/config/loader.js +11 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/types.d.ts +83 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/config/utils.d.ts +26 -0
- package/dist/config/utils.js +2 -0
- package/dist/config/utils.js.map +1 -0
- package/dist/context/async-context.d.ts +13 -0
- package/dist/context/async-context.js +16 -0
- package/dist/context/async-context.js.map +1 -0
- package/dist/context/environment.d.ts +13 -0
- package/dist/context/environment.js +3 -0
- package/dist/context/environment.js.map +1 -0
- package/dist/events/CommandKitEventsChannel.d.ts +13 -0
- package/dist/events/CommandKitEventsChannel.js +2 -0
- package/dist/events/CommandKitEventsChannel.js.map +1 -0
- package/dist/flags/feature-flags.d.ts +13 -0
- package/dist/flags/feature-flags.js +16 -0
- package/dist/flags/feature-flags.js.map +1 -0
- package/dist/flags/store.d.ts +13 -0
- package/dist/flags/store.js +2 -0
- package/dist/flags/store.js.map +1 -0
- package/dist/index.d.ts +51 -2024
- package/dist/index.js +43 -6912
- package/dist/index.js.map +1 -1
- package/dist/logger/DefaultLogger.d.ts +28 -0
- package/dist/logger/DefaultLogger.js +3 -0
- package/dist/logger/DefaultLogger.js.map +1 -0
- package/dist/logger/ILogger.d.ts +9 -0
- package/dist/logger/ILogger.js +2 -0
- package/dist/logger/ILogger.js.map +1 -0
- package/dist/logger/Logger.d.ts +15 -0
- package/dist/logger/Logger.js +3 -0
- package/dist/logger/Logger.js.map +1 -0
- package/dist/plugins/CompilerPlugin.d.ts +13 -0
- package/dist/plugins/CompilerPlugin.js +2 -0
- package/dist/plugins/CompilerPlugin.js.map +1 -0
- package/dist/plugins/PluginCommon.d.ts +13 -0
- package/dist/plugins/PluginCommon.js +2 -0
- package/dist/plugins/PluginCommon.js.map +1 -0
- package/dist/plugins/RuntimePlugin.d.ts +13 -0
- package/dist/plugins/RuntimePlugin.js +2 -0
- package/dist/plugins/RuntimePlugin.js.map +1 -0
- package/dist/plugins/index.d.ts +15 -0
- package/dist/plugins/index.js +3 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +13 -0
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +3 -0
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js.map +1 -0
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +13 -0
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +3 -0
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js.map +1 -0
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +26 -0
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +3 -0
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js.map +1 -0
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +23 -0
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +3 -0
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js.map +1 -0
- package/dist/plugins/plugin-runtime/runtime.d.ts +13 -0
- package/dist/plugins/plugin-runtime/runtime.js +2 -0
- package/dist/plugins/plugin-runtime/runtime.js.map +1 -0
- package/dist/plugins/plugin-runtime/types.d.ts +72 -0
- package/dist/plugins/plugin-runtime/types.js +2 -0
- package/dist/plugins/plugin-runtime/types.js.map +1 -0
- package/dist/plugins/types.d.ts +13 -0
- package/dist/plugins/types.js +2 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/types.d.ts +13 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/clone.d.ts +3 -0
- package/dist/utils/clone.js +2 -0
- package/dist/utils/clone.js.map +1 -0
- package/dist/utils/colors.d.ts +5 -0
- package/dist/utils/colors.js +2 -0
- package/dist/utils/colors.js.map +1 -0
- package/dist/utils/constants.d.ts +15 -0
- package/dist/utils/constants.js +2 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/dev-hooks.d.ts +13 -0
- package/dist/utils/dev-hooks.js +3 -0
- package/dist/utils/dev-hooks.js.map +1 -0
- package/dist/utils/error-codes.d.ts +14 -0
- package/dist/utils/error-codes.js +2 -0
- package/dist/utils/error-codes.js.map +1 -0
- package/dist/utils/get-paths.d.ts +4 -0
- package/dist/utils/get-paths.js +2 -0
- package/dist/utils/get-paths.js.map +1 -0
- package/dist/utils/resolve-file-url.d.ts +9 -0
- package/dist/utils/resolve-file-url.js +2 -0
- package/dist/utils/resolve-file-url.js.map +1 -0
- package/dist/utils/types-package.d.ts +4 -0
- package/dist/utils/types-package.js +14 -0
- package/dist/utils/types-package.js.map +1 -0
- package/dist/utils/utilities.d.ts +40 -0
- package/dist/utils/utilities.js +3 -0
- package/dist/utils/utilities.js.map +1 -0
- package/dist/utils/warn-unstable.d.ts +4 -0
- package/dist/utils/warn-unstable.js +2 -0
- package/dist/utils/warn-unstable.js.map +1 -0
- package/dist/version.d.ts +6 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/hooks.cjs +48 -0
- package/hooks.d.ts +18 -0
- package/jsx-runtime.cjs +1 -1
- package/jsx-runtime.d.ts +1 -1
- package/package.json +32 -5
- package/plugin.cjs +10 -0
- package/plugin.d.ts +9 -0
- package/jsx-runtime.mjs +0 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,2024 +1,51 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Whether the collector should run only once.
|
|
54
|
-
*/
|
|
55
|
-
once?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* The handler to run when the collector ends.
|
|
58
|
-
*/
|
|
59
|
-
onEnd?: (reason: string) => Awaitable<void>;
|
|
60
|
-
/**
|
|
61
|
-
* The handler to run upon an error.
|
|
62
|
-
*/
|
|
63
|
-
onError?: EventInterceptorErrorHandler;
|
|
64
|
-
}
|
|
65
|
-
type EventInterceptorErrorHandler = (error: Error) => Awaitable<void>;
|
|
66
|
-
declare class EventInterceptor {
|
|
67
|
-
#private;
|
|
68
|
-
readonly client: Client;
|
|
69
|
-
private subscribers;
|
|
70
|
-
private globalHandlers;
|
|
71
|
-
private cleanupTimer;
|
|
72
|
-
/**
|
|
73
|
-
* Creates the event interceptor.
|
|
74
|
-
*/
|
|
75
|
-
constructor(client: Client);
|
|
76
|
-
/**
|
|
77
|
-
* Destroys the event interceptor.
|
|
78
|
-
*/
|
|
79
|
-
destroy(): void;
|
|
80
|
-
/**
|
|
81
|
-
* Whether the event has subscribers.
|
|
82
|
-
* @param event The event to check.
|
|
83
|
-
*/
|
|
84
|
-
hasSubscribers(event: keyof ClientEvents): boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Returns the number of subscribers for the event.
|
|
87
|
-
* @param event The event to check.
|
|
88
|
-
*/
|
|
89
|
-
getSubscriberCount(event: keyof ClientEvents): number;
|
|
90
|
-
/**
|
|
91
|
-
* Whether the event has global handlers.
|
|
92
|
-
*/
|
|
93
|
-
hasGlobalHandlers(): boolean;
|
|
94
|
-
/**
|
|
95
|
-
* Returns the number of global handlers.
|
|
96
|
-
*/
|
|
97
|
-
getGlobalHandlersCount(): number;
|
|
98
|
-
/**
|
|
99
|
-
* Subscribes to an event.
|
|
100
|
-
* @param event The event to subscribe to.
|
|
101
|
-
* @param listener The listener to call when the event is emitted.
|
|
102
|
-
* @returns A function to unsubscribe from the event.
|
|
103
|
-
*/
|
|
104
|
-
subscribe<Event extends keyof ClientEvents>(event: Event, listener: (...args: ClientEvents[Event]) => void, options?: EventInterceptorContextData<Event>): () => void;
|
|
105
|
-
/**
|
|
106
|
-
* Unsubscribes from an event.
|
|
107
|
-
* @param event The event to unsubscribe from.
|
|
108
|
-
*/
|
|
109
|
-
unsubscribe<Event extends keyof ClientEvents>(event: Event, listener: (...args: ClientEvents[Event]) => void, reason?: string): void;
|
|
110
|
-
/**
|
|
111
|
-
* Creates a global handler for the event.
|
|
112
|
-
* @param event The event to create a global handler for.
|
|
113
|
-
* @returns The global handler.
|
|
114
|
-
*/
|
|
115
|
-
private createGlobalHandler;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
type ButtonKitPredicate = (interaction: ButtonInteraction) => Awaitable<boolean>;
|
|
119
|
-
/**
|
|
120
|
-
* The handler to run when a button is clicked. This handler is called with the interaction as the first argument.
|
|
121
|
-
* If the first argument is null, it means that the interaction collector has been destroyed.
|
|
122
|
-
*/
|
|
123
|
-
type OnButtonKitClick = CommandKitButtonBuilderInteractionCollectorDispatch;
|
|
124
|
-
/**
|
|
125
|
-
* The handler to run when the interaction collector ends. This handler is called with the reason as the first argument.
|
|
126
|
-
* If the first argument is null, it means that the interaction collector has been destroyed.
|
|
127
|
-
*/
|
|
128
|
-
type OnButtonKitEnd = CommandKitButtonBuilderOnEnd;
|
|
129
|
-
/**
|
|
130
|
-
* The handler to run when a button is clicked. This handler is called with the interaction as the first argument.
|
|
131
|
-
* If the first argument is null, it means that the interaction collector has been destroyed.
|
|
132
|
-
*/
|
|
133
|
-
type CommandKitButtonBuilderInteractionCollectorDispatch = (interaction: ButtonInteraction, context: ButtonKit) => Awaitable<void>;
|
|
134
|
-
type CommandKitButtonBuilderOnEnd = (reason: string) => Awaitable<void>;
|
|
135
|
-
type CommandKitButtonBuilderInteractionCollectorDispatchContextData = EventInterceptorContextData<Events.InteractionCreate>;
|
|
136
|
-
declare class ButtonKit extends ButtonBuilder {
|
|
137
|
-
#private;
|
|
138
|
-
/**
|
|
139
|
-
* Sets up an inline interaction collector for this button. This collector by default allows as many interactions as possible if it is actively used.
|
|
140
|
-
* If unused, this expires after 24 hours or custom time if specified.
|
|
141
|
-
* @param handler The handler to run when the button is clicked
|
|
142
|
-
* @param data The context data to use for the interaction collector
|
|
143
|
-
* @returns This button
|
|
144
|
-
* @example
|
|
145
|
-
* ```ts
|
|
146
|
-
* const button = new ButtonKit()
|
|
147
|
-
* .setLabel('Click me')
|
|
148
|
-
* .setStyle(ButtonStyle.Primary)
|
|
149
|
-
* .setCustomId('click_me')
|
|
150
|
-
* .filter((interaction) => interaction.user.id === '1234567890')
|
|
151
|
-
* .onClick(async (interaction) => {
|
|
152
|
-
* await interaction.reply('You clicked me!');
|
|
153
|
-
* });
|
|
154
|
-
*
|
|
155
|
-
* const row = new ActionRowBuilder().addComponents(button);
|
|
156
|
-
*
|
|
157
|
-
* const message = await channel.send({ content: 'Click the button', components: [row] });
|
|
158
|
-
*
|
|
159
|
-
* // Remove onClick handler and destroy the interaction collector
|
|
160
|
-
* button.onClick(null);
|
|
161
|
-
* ```
|
|
162
|
-
*/
|
|
163
|
-
onClick(handler: CommandKitButtonBuilderInteractionCollectorDispatch, data?: CommandKitButtonBuilderInteractionCollectorDispatchContextData): this;
|
|
164
|
-
onEnd(handler: CommandKitButtonBuilderOnEnd): this;
|
|
165
|
-
/**
|
|
166
|
-
* Sets the handler to run when the interaction collector ends.
|
|
167
|
-
* @param handler - The handler to run when the interaction collector ends.
|
|
168
|
-
* @returns This instance of the modal builder.
|
|
169
|
-
*/
|
|
170
|
-
onError(handler: EventInterceptorErrorHandler): this;
|
|
171
|
-
/**
|
|
172
|
-
* Sets a filter for the interaction collector.
|
|
173
|
-
* @param predicate The filter to use for the interaction collector
|
|
174
|
-
*/
|
|
175
|
-
filter(predicate: ButtonKitPredicate): this;
|
|
176
|
-
private get customId();
|
|
177
|
-
dispose(): this;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
type ModalKitPredicate = (interaction: ModalSubmitInteraction) => Awaitable<boolean>;
|
|
181
|
-
/**
|
|
182
|
-
* The handler to run when a modal is submitted. This handler is called with the interaction as the first argument.
|
|
183
|
-
* If the first argument is null, it means that the interaction collector has been destroyed.
|
|
184
|
-
*/
|
|
185
|
-
type OnModalKitSubmit = CommandKitModalBuilderInteractionCollectorDispatch;
|
|
186
|
-
/**
|
|
187
|
-
* The handler to run when the interaction collector ends. This handler is called with the reason as the first argument.
|
|
188
|
-
* If the first argument is null, it means that the interaction collector has been destroyed.
|
|
189
|
-
*/
|
|
190
|
-
type OnModalKitEnd = CommandKitModalBuilderOnEnd;
|
|
191
|
-
/**
|
|
192
|
-
* The handler to run when a modal is submitted. This handler is called with the interaction as the first argument.
|
|
193
|
-
* If the first argument is null, it means that the interaction collector has been destroyed.
|
|
194
|
-
*/
|
|
195
|
-
type CommandKitModalBuilderInteractionCollectorDispatch = (interaction: ModalSubmitInteraction, context: ModalKit) => Awaitable<void>;
|
|
196
|
-
type CommandKitModalBuilderOnEnd = (reason: string) => Awaitable<void>;
|
|
197
|
-
type CommandKitModalBuilderInteractionCollectorDispatchContextData = EventInterceptorContextData<Events.InteractionCreate>;
|
|
198
|
-
declare class ModalKit extends ModalBuilder {
|
|
199
|
-
#private;
|
|
200
|
-
/**
|
|
201
|
-
* Sets the handler to run when the modal is submitted.
|
|
202
|
-
* @param handler - The handler to run when the modal is submitted.
|
|
203
|
-
* @param data - The context data for the interaction collector.
|
|
204
|
-
* @returns This instance of the modal builder.
|
|
205
|
-
* @example
|
|
206
|
-
* ```ts
|
|
207
|
-
* const modal = new ModalKit()
|
|
208
|
-
* .setTitle('My Modal')
|
|
209
|
-
* .setCustomId('my-modal')
|
|
210
|
-
* .filter((interaction) => interaction.user.id === '1234567890')
|
|
211
|
-
* .onSubmit(async (interaction) => {
|
|
212
|
-
* await interaction.reply('You submitted the modal!');
|
|
213
|
-
* })
|
|
214
|
-
* .addComponents(actionRow1, actionRow2);
|
|
215
|
-
* ```
|
|
216
|
-
*/
|
|
217
|
-
onSubmit(handler: CommandKitModalBuilderInteractionCollectorDispatch, data?: CommandKitModalBuilderInteractionCollectorDispatchContextData): this;
|
|
218
|
-
/**
|
|
219
|
-
* Sets the handler to run when the interaction collector ends.
|
|
220
|
-
* @param handler - The handler to run when the interaction collector ends.
|
|
221
|
-
* @returns This instance of the modal builder.
|
|
222
|
-
*/
|
|
223
|
-
onEnd(handler: CommandKitModalBuilderOnEnd): this;
|
|
224
|
-
/**
|
|
225
|
-
* Sets the handler to run when the interaction collector ends.
|
|
226
|
-
* @param handler - The handler to run when the interaction collector ends.
|
|
227
|
-
* @returns This instance of the modal builder.
|
|
228
|
-
*/
|
|
229
|
-
onError(handler: EventInterceptorErrorHandler): this;
|
|
230
|
-
/**
|
|
231
|
-
* Sets a filter for the interaction collector.
|
|
232
|
-
* @param predicate - The filter to use for the interaction collector.
|
|
233
|
-
* @returns This instance of the modal builder.
|
|
234
|
-
*/
|
|
235
|
-
filter(predicate: ModalKitPredicate): this;
|
|
236
|
-
private get customId();
|
|
237
|
-
dispose(): this;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
declare const ElementType: {
|
|
241
|
-
readonly ActionRow: "action-row";
|
|
242
|
-
readonly Button: "button-kit";
|
|
243
|
-
readonly Modal: "modal";
|
|
244
|
-
readonly TextInput: "text-input";
|
|
245
|
-
};
|
|
246
|
-
type ElementType = (typeof ElementType)[keyof typeof ElementType];
|
|
247
|
-
interface CommandKitElementData {
|
|
248
|
-
[ElementType.ActionRow]: ActionRowBuilder;
|
|
249
|
-
[ElementType.Button]: ButtonKit;
|
|
250
|
-
[ElementType.Modal]: ModalKit;
|
|
251
|
-
[ElementType.TextInput]: TextInputBuilder;
|
|
252
|
-
}
|
|
253
|
-
type CommandKitElement<Type extends ElementType> = CommandKitElementData[Type];
|
|
254
|
-
type AnyCommandKitElement = CommandKitElement<ElementType>;
|
|
255
|
-
declare function isCommandKitElement(element: unknown): element is CommandKitElement<ElementType>;
|
|
256
|
-
declare function getElement<T extends ElementType, E extends CommandKitElement<T>>(element: E): CommandKitElementData[T];
|
|
257
|
-
interface FragmentElementProps {
|
|
258
|
-
children: [];
|
|
259
|
-
}
|
|
260
|
-
declare function Fragment(props: FragmentElementProps): CommandKitElementData[ElementType][];
|
|
261
|
-
declare function createElement(type: Function, props: Record<string, unknown>, ...children: any[]): CommandKitElement<ElementType>;
|
|
262
|
-
|
|
263
|
-
interface ActionRowProps {
|
|
264
|
-
children?: AnyCommandKitElement[] | AnyCommandKitElement;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* The action row component.
|
|
268
|
-
* @param props The action row properties.
|
|
269
|
-
* @returns The commandkit element.
|
|
270
|
-
* @example <ActionRow><Button label="Click me" style={ButtonStyle.Primary} customId="click_me" /></ActionRow>
|
|
271
|
-
*/
|
|
272
|
-
declare function ActionRow(props: ActionRowProps): CommandKitElement<'action-row'>;
|
|
273
|
-
|
|
274
|
-
type MaybeArray<T> = T | T[];
|
|
275
|
-
|
|
276
|
-
type ButtonChildrenLike = string | number | boolean;
|
|
277
|
-
interface ButtonProps {
|
|
278
|
-
label?: string;
|
|
279
|
-
style?: ButtonStyle;
|
|
280
|
-
emoji?: ComponentEmojiResolvable;
|
|
281
|
-
disabled?: boolean;
|
|
282
|
-
customId?: string;
|
|
283
|
-
url?: string;
|
|
284
|
-
skuId?: string;
|
|
285
|
-
onClick?: CommandKitButtonBuilderInteractionCollectorDispatch;
|
|
286
|
-
onError?: EventInterceptorErrorHandler;
|
|
287
|
-
options?: CommandKitButtonBuilderInteractionCollectorDispatchContextData;
|
|
288
|
-
onEnd?: CommandKitButtonBuilderOnEnd;
|
|
289
|
-
children?: MaybeArray<ButtonChildrenLike>;
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* The button component.
|
|
293
|
-
* @param props The button properties.
|
|
294
|
-
* @returns The commandkit element.
|
|
295
|
-
* @example <Button style={ButtonStyle.Primary} customId="click_me">Click Me</Button>
|
|
296
|
-
*/
|
|
297
|
-
declare function Button(props: ButtonProps): CommandKitElement<'button-kit'>;
|
|
298
|
-
|
|
299
|
-
interface ModalProps {
|
|
300
|
-
customId?: string;
|
|
301
|
-
title: string;
|
|
302
|
-
children?: MaybeArray<TextInputBuilder | ActionRowBuilder>;
|
|
303
|
-
onSubmit?: OnModalKitSubmit;
|
|
304
|
-
onEnd?: OnModalKitEnd;
|
|
305
|
-
onError?: EventInterceptorErrorHandler;
|
|
306
|
-
options?: CommandKitModalBuilderInteractionCollectorDispatchContextData;
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* The modal component.
|
|
310
|
-
* @param props The modal properties.
|
|
311
|
-
* @returns The commandkit element.
|
|
312
|
-
* @example <Modal title="My Modal" onSubmit={onSubmit}>...</Modal>
|
|
313
|
-
*/
|
|
314
|
-
declare function Modal(props: ModalProps): CommandKitElement<'modal'>;
|
|
315
|
-
interface TextInputProps {
|
|
316
|
-
customId: string;
|
|
317
|
-
label: string;
|
|
318
|
-
placeholder?: string;
|
|
319
|
-
maxLength?: number;
|
|
320
|
-
minLength?: number;
|
|
321
|
-
value?: string;
|
|
322
|
-
required?: boolean;
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* The text input component.
|
|
326
|
-
* @param props The text input properties.
|
|
327
|
-
* @returns The commandkit element.
|
|
328
|
-
* @example <TextInput customId="input" label="Input" style={TextInputStyle.Short} />
|
|
329
|
-
*/
|
|
330
|
-
declare function TextInput(props: TextInputProps & {
|
|
331
|
-
style: TextInputStyle;
|
|
332
|
-
}): CommandKitElement<'text-input'>;
|
|
333
|
-
/**
|
|
334
|
-
* The short text input component.
|
|
335
|
-
* @param props The text input properties.
|
|
336
|
-
* @returns The commandkit element.
|
|
337
|
-
* @example <ShortInput customId="input" label="Input" />
|
|
338
|
-
*/
|
|
339
|
-
declare function ShortInput(props: TextInputProps): CommandKitElement<'text-input'>;
|
|
340
|
-
/**
|
|
341
|
-
* The paragraph text input component.
|
|
342
|
-
* @param props The text input properties.
|
|
343
|
-
* @returns The commandkit element.
|
|
344
|
-
* @example <ParagraphInput customId="input" label="Input" />
|
|
345
|
-
*/
|
|
346
|
-
declare function ParagraphInput(props: TextInputProps): CommandKitElement<'text-input'>;
|
|
347
|
-
|
|
348
|
-
type SelectMenuKitPredicate<T> = (interaction: T) => Awaitable<boolean>;
|
|
349
|
-
/**
|
|
350
|
-
* The handler to run when a modal is submitted. This handler is called with the interaction as the first argument.
|
|
351
|
-
* If the first argument is null, it means that the interaction collector has been destroyed.
|
|
352
|
-
*/
|
|
353
|
-
type OnSelectMenuKitSubmit<T, C> = CommandKitSelectMenuBuilderInteractionCollectorDispatch<T, C>;
|
|
354
|
-
/**
|
|
355
|
-
* The handler to run when the interaction collector ends. This handler is called with the reason as the first argument.
|
|
356
|
-
* If the first argument is null, it means that the interaction collector has been destroyed.
|
|
357
|
-
*/
|
|
358
|
-
type OnSelectMenuKitEnd = CommandKitSelectMenuBuilderOnEnd;
|
|
359
|
-
/**
|
|
360
|
-
* The handler to run when a modal is submitted. This handler is called with the interaction as the first argument.
|
|
361
|
-
* If the first argument is null, it means that the interaction collector has been destroyed.
|
|
362
|
-
*/
|
|
363
|
-
type CommandKitSelectMenuBuilderInteractionCollectorDispatch<T, C> = (interaction: T, context: C) => Awaitable<void>;
|
|
364
|
-
type CommandKitSelectMenuBuilderOnEnd = (reason: string) => Awaitable<void>;
|
|
365
|
-
type CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData = EventInterceptorContextData<Events.InteractionCreate>;
|
|
366
|
-
|
|
367
|
-
type OnStringSelectMenuKitSubmit = OnSelectMenuKitSubmit<StringSelectMenuInteraction, StringSelectMenuKit>;
|
|
368
|
-
type StringSelectMenuKitPredicate = SelectMenuKitPredicate<StringSelectMenuInteraction>;
|
|
369
|
-
declare class StringSelectMenuKit extends StringSelectMenuBuilder {
|
|
370
|
-
#private;
|
|
371
|
-
/**
|
|
372
|
-
* Sets the handler to run when the modal is submitted.
|
|
373
|
-
* @param handler - The handler to run when the modal is submitted.
|
|
374
|
-
* @param data - The context data for the interaction collector.
|
|
375
|
-
* @returns This instance of the modal builder.
|
|
376
|
-
* @example
|
|
377
|
-
* ```ts
|
|
378
|
-
* const modal = new StringSelectMenuKit()
|
|
379
|
-
* .setTitle('My Modal')
|
|
380
|
-
* .setCustomId('my-modal')
|
|
381
|
-
* .filter((interaction) => interaction.user.id === '1234567890')
|
|
382
|
-
* .onSelect(async (interaction) => {
|
|
383
|
-
* await interaction.reply('You submitted the modal!');
|
|
384
|
-
* })
|
|
385
|
-
* .addComponents(actionRow1, actionRow2);
|
|
386
|
-
* ```
|
|
387
|
-
*/
|
|
388
|
-
onSelect(handler: CommandKitSelectMenuBuilderInteractionCollectorDispatch<StringSelectMenuInteraction, StringSelectMenuKit>, data?: CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData): this;
|
|
389
|
-
/**
|
|
390
|
-
* Sets the handler to run when the interaction collector ends.
|
|
391
|
-
* @param handler - The handler to run when the interaction collector ends.
|
|
392
|
-
* @returns This instance of the modal builder.
|
|
393
|
-
*/
|
|
394
|
-
onEnd(handler: CommandKitSelectMenuBuilderOnEnd): this;
|
|
395
|
-
/**
|
|
396
|
-
* Sets the handler to run when the interaction collector ends.
|
|
397
|
-
* @param handler - The handler to run when the interaction collector ends.
|
|
398
|
-
* @returns This instance of the modal builder.
|
|
399
|
-
*/
|
|
400
|
-
onError(handler: EventInterceptorErrorHandler): this;
|
|
401
|
-
/**
|
|
402
|
-
* Sets a filter for the interaction collector.
|
|
403
|
-
* @param predicate - The filter to use for the interaction collector.
|
|
404
|
-
* @returns This instance of the modal builder.
|
|
405
|
-
*/
|
|
406
|
-
filter(predicate: SelectMenuKitPredicate<StringSelectMenuInteraction>): this;
|
|
407
|
-
private get customId();
|
|
408
|
-
dispose(): this;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
type OnChannelSelectMenuKitSubmit = OnSelectMenuKitSubmit<ChannelSelectMenuInteraction, ChannelSelectMenuKit>;
|
|
412
|
-
type ChannelSelectMenuKitPredicate = SelectMenuKitPredicate<ChannelSelectMenuInteraction>;
|
|
413
|
-
declare class ChannelSelectMenuKit extends ChannelSelectMenuBuilder {
|
|
414
|
-
#private;
|
|
415
|
-
/**
|
|
416
|
-
* Sets the handler to run when the modal is submitted.
|
|
417
|
-
* @param handler - The handler to run when the modal is submitted.
|
|
418
|
-
* @param data - The context data for the interaction collector.
|
|
419
|
-
* @returns This instance of the modal builder.
|
|
420
|
-
* @example
|
|
421
|
-
* ```ts
|
|
422
|
-
* const modal = new ChannelSelectMenuKit()
|
|
423
|
-
* .setTitle('My Modal')
|
|
424
|
-
* .setCustomId('my-modal')
|
|
425
|
-
* .filter((interaction) => interaction.Channel.id === '1234567890')
|
|
426
|
-
* .onSelect(async (interaction) => {
|
|
427
|
-
* await interaction.reply('You submitted the modal!');
|
|
428
|
-
* })
|
|
429
|
-
* .addComponents(actionRow1, actionRow2);
|
|
430
|
-
* ```
|
|
431
|
-
*/
|
|
432
|
-
onSelect(handler: CommandKitSelectMenuBuilderInteractionCollectorDispatch<ChannelSelectMenuInteraction, ChannelSelectMenuKit>, data?: CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData): this;
|
|
433
|
-
/**
|
|
434
|
-
* Sets the handler to run when the interaction collector ends.
|
|
435
|
-
* @param handler - The handler to run when the interaction collector ends.
|
|
436
|
-
* @returns This instance of the modal builder.
|
|
437
|
-
*/
|
|
438
|
-
onEnd(handler: CommandKitSelectMenuBuilderOnEnd): this;
|
|
439
|
-
/**
|
|
440
|
-
* Sets the handler to run when the interaction collector ends.
|
|
441
|
-
* @param handler - The handler to run when the interaction collector ends.
|
|
442
|
-
* @returns This instance of the modal builder.
|
|
443
|
-
*/
|
|
444
|
-
onError(handler: EventInterceptorErrorHandler): this;
|
|
445
|
-
/**
|
|
446
|
-
* Sets a filter for the interaction collector.
|
|
447
|
-
* @param predicate - The filter to use for the interaction collector.
|
|
448
|
-
* @returns This instance of the modal builder.
|
|
449
|
-
*/
|
|
450
|
-
filter(predicate: SelectMenuKitPredicate<ChannelSelectMenuInteraction>): this;
|
|
451
|
-
private get customId();
|
|
452
|
-
dispose(): this;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
type OnMentionableSelectMenuKitSubmit = OnSelectMenuKitSubmit<MentionableSelectMenuInteraction, MentionableSelectMenuKit>;
|
|
456
|
-
type MentionableSelectMenuKitPredicate = SelectMenuKitPredicate<MentionableSelectMenuInteraction>;
|
|
457
|
-
declare class MentionableSelectMenuKit extends MentionableSelectMenuBuilder {
|
|
458
|
-
#private;
|
|
459
|
-
/**
|
|
460
|
-
* Sets the handler to run when the modal is submitted.
|
|
461
|
-
* @param handler - The handler to run when the modal is submitted.
|
|
462
|
-
* @param data - The context data for the interaction collector.
|
|
463
|
-
* @returns This instance of the modal builder.
|
|
464
|
-
* @example
|
|
465
|
-
* ```ts
|
|
466
|
-
* const modal = new MentionableSelectMenuKit()
|
|
467
|
-
* .setTitle('My Modal')
|
|
468
|
-
* .setCustomId('my-modal')
|
|
469
|
-
* .filter((interaction) => interaction.Mentionable.id === '1234567890')
|
|
470
|
-
* .onSelect(async (interaction) => {
|
|
471
|
-
* await interaction.reply('You submitted the modal!');
|
|
472
|
-
* })
|
|
473
|
-
* .addComponents(actionRow1, actionRow2);
|
|
474
|
-
* ```
|
|
475
|
-
*/
|
|
476
|
-
onSelect(handler: CommandKitSelectMenuBuilderInteractionCollectorDispatch<MentionableSelectMenuInteraction, MentionableSelectMenuKit>, data?: CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData): this;
|
|
477
|
-
/**
|
|
478
|
-
* Sets the handler to run when the interaction collector ends.
|
|
479
|
-
* @param handler - The handler to run when the interaction collector ends.
|
|
480
|
-
* @returns This instance of the modal builder.
|
|
481
|
-
*/
|
|
482
|
-
onEnd(handler: CommandKitSelectMenuBuilderOnEnd): this;
|
|
483
|
-
/**
|
|
484
|
-
* Sets the handler to run when the interaction collector ends.
|
|
485
|
-
* @param handler - The handler to run when the interaction collector ends.
|
|
486
|
-
* @returns This instance of the modal builder.
|
|
487
|
-
*/
|
|
488
|
-
onError(handler: EventInterceptorErrorHandler): this;
|
|
489
|
-
/**
|
|
490
|
-
* Sets a filter for the interaction collector.
|
|
491
|
-
* @param predicate - The filter to use for the interaction collector.
|
|
492
|
-
* @returns This instance of the modal builder.
|
|
493
|
-
*/
|
|
494
|
-
filter(predicate: SelectMenuKitPredicate<MentionableSelectMenuInteraction>): this;
|
|
495
|
-
private get customId();
|
|
496
|
-
dispose(): this;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
type OnUserSelectMenuKitSubmit = OnSelectMenuKitSubmit<UserSelectMenuInteraction, UserSelectMenuKit>;
|
|
500
|
-
type UserSelectMenuKitPredicate = SelectMenuKitPredicate<UserSelectMenuInteraction>;
|
|
501
|
-
declare class UserSelectMenuKit extends UserSelectMenuBuilder {
|
|
502
|
-
#private;
|
|
503
|
-
/**
|
|
504
|
-
* Sets the handler to run when the modal is submitted.
|
|
505
|
-
* @param handler - The handler to run when the modal is submitted.
|
|
506
|
-
* @param data - The context data for the interaction collector.
|
|
507
|
-
* @returns This instance of the modal builder.
|
|
508
|
-
* @example
|
|
509
|
-
* ```ts
|
|
510
|
-
* const modal = new UserSelectMenuKit()
|
|
511
|
-
* .setTitle('My Modal')
|
|
512
|
-
* .setCustomId('my-modal')
|
|
513
|
-
* .filter((interaction) => interaction.user.id === '1234567890')
|
|
514
|
-
* .onSelect(async (interaction) => {
|
|
515
|
-
* await interaction.reply('You submitted the modal!');
|
|
516
|
-
* })
|
|
517
|
-
* .addComponents(actionRow1, actionRow2);
|
|
518
|
-
* ```
|
|
519
|
-
*/
|
|
520
|
-
onSelect(handler: CommandKitSelectMenuBuilderInteractionCollectorDispatch<UserSelectMenuInteraction, UserSelectMenuKit>, data?: CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData): this;
|
|
521
|
-
/**
|
|
522
|
-
* Sets the handler to run when the interaction collector ends.
|
|
523
|
-
* @param handler - The handler to run when the interaction collector ends.
|
|
524
|
-
* @returns This instance of the modal builder.
|
|
525
|
-
*/
|
|
526
|
-
onEnd(handler: CommandKitSelectMenuBuilderOnEnd): this;
|
|
527
|
-
/**
|
|
528
|
-
* Sets the handler to run when the interaction collector ends.
|
|
529
|
-
* @param handler - The handler to run when the interaction collector ends.
|
|
530
|
-
* @returns This instance of the modal builder.
|
|
531
|
-
*/
|
|
532
|
-
onError(handler: EventInterceptorErrorHandler): this;
|
|
533
|
-
/**
|
|
534
|
-
* Sets a filter for the interaction collector.
|
|
535
|
-
* @param predicate - The filter to use for the interaction collector.
|
|
536
|
-
* @returns This instance of the modal builder.
|
|
537
|
-
*/
|
|
538
|
-
filter(predicate: SelectMenuKitPredicate<UserSelectMenuInteraction>): this;
|
|
539
|
-
private get customId();
|
|
540
|
-
dispose(): this;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
type OnRoleSelectMenuKitSubmit = OnSelectMenuKitSubmit<RoleSelectMenuInteraction, RoleSelectMenuKit>;
|
|
544
|
-
type RoleSelectMenuKitPredicate = SelectMenuKitPredicate<RoleSelectMenuInteraction>;
|
|
545
|
-
declare class RoleSelectMenuKit extends RoleSelectMenuBuilder {
|
|
546
|
-
#private;
|
|
547
|
-
/**
|
|
548
|
-
* Sets the handler to run when the modal is submitted.
|
|
549
|
-
* @param handler - The handler to run when the modal is submitted.
|
|
550
|
-
* @param data - The context data for the interaction collector.
|
|
551
|
-
* @returns This instance of the modal builder.
|
|
552
|
-
* @example
|
|
553
|
-
* ```ts
|
|
554
|
-
* const modal = new RoleSelectMenuKit()
|
|
555
|
-
* .setTitle('My Modal')
|
|
556
|
-
* .setCustomId('my-modal')
|
|
557
|
-
* .filter((interaction) => interaction.Role.id === '1234567890')
|
|
558
|
-
* .onSelect(async (interaction) => {
|
|
559
|
-
* await interaction.reply('You submitted the modal!');
|
|
560
|
-
* })
|
|
561
|
-
* .addComponents(actionRow1, actionRow2);
|
|
562
|
-
* ```
|
|
563
|
-
*/
|
|
564
|
-
onSelect(handler: CommandKitSelectMenuBuilderInteractionCollectorDispatch<RoleSelectMenuInteraction, RoleSelectMenuKit>, data?: CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData): this;
|
|
565
|
-
/**
|
|
566
|
-
* Sets the handler to run when the interaction collector ends.
|
|
567
|
-
* @param handler - The handler to run when the interaction collector ends.
|
|
568
|
-
* @returns This instance of the modal builder.
|
|
569
|
-
*/
|
|
570
|
-
onEnd(handler: CommandKitSelectMenuBuilderOnEnd): this;
|
|
571
|
-
/**
|
|
572
|
-
* Sets the handler to run when the interaction collector ends.
|
|
573
|
-
* @param handler - The handler to run when the interaction collector ends.
|
|
574
|
-
* @returns This instance of the modal builder.
|
|
575
|
-
*/
|
|
576
|
-
onError(handler: EventInterceptorErrorHandler): this;
|
|
577
|
-
/**
|
|
578
|
-
* Sets a filter for the interaction collector.
|
|
579
|
-
* @param predicate - The filter to use for the interaction collector.
|
|
580
|
-
* @returns This instance of the modal builder.
|
|
581
|
-
*/
|
|
582
|
-
filter(predicate: SelectMenuKitPredicate<RoleSelectMenuInteraction>): this;
|
|
583
|
-
private get customId();
|
|
584
|
-
dispose(): this;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
interface CommonSelectMenuProps<T, C> {
|
|
588
|
-
onSelect?: CommandKitSelectMenuBuilderInteractionCollectorDispatch<T, C>;
|
|
589
|
-
onEnd?: CommandKitSelectMenuBuilderOnEnd;
|
|
590
|
-
onError?: (error: Error) => any;
|
|
591
|
-
options?: CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData;
|
|
592
|
-
}
|
|
593
|
-
interface SelectMenuProps<T, C> extends Partial<Omit<BaseSelectMenuComponentData, 'type'>>, CommonSelectMenuProps<T, C> {
|
|
594
|
-
}
|
|
595
|
-
interface StringSelectMenuProps extends SelectMenuProps<StringSelectMenuInteraction, StringSelectMenuKit> {
|
|
596
|
-
children?: MaybeArray<StringSelectMenuOptionBuilder>;
|
|
597
|
-
}
|
|
598
|
-
type CommonBuilderKit = StringSelectMenuKit | UserSelectMenuKit | RoleSelectMenuKit | ChannelSelectMenuKit | MentionableSelectMenuKit;
|
|
599
|
-
type ResolveBuilderInteraction<T> = T extends StringSelectMenuKit ? StringSelectMenuInteraction : T extends UserSelectMenuKit ? UserSelectMenuInteraction : T extends RoleSelectMenuKit ? RoleSelectMenuInteraction : T extends ChannelSelectMenuKit ? ChannelSelectMenuInteraction : T extends MentionableSelectMenuKit ? MentionableSelectMenuInteraction : never;
|
|
600
|
-
declare function StringSelectMenu(props: StringSelectMenuProps): StringSelectMenuKit;
|
|
601
|
-
type StringSelectMenuOptionProps = SelectMenuComponentOptionData | APISelectMenuOption;
|
|
602
|
-
declare function StringSelectMenuOption(props: StringSelectMenuOptionProps): StringSelectMenuOptionBuilder;
|
|
603
|
-
interface UserSelectMenuProps extends Partial<Omit<UserSelectMenuComponentData, 'type'>>, CommonSelectMenuProps<UserSelectMenuInteraction, UserSelectMenuKit> {
|
|
604
|
-
}
|
|
605
|
-
declare function UserSelectMenu(props: UserSelectMenuProps): UserSelectMenuKit;
|
|
606
|
-
interface RoleSelectMenuProps extends Partial<Omit<RoleSelectMenuComponentData, 'type'>>, CommonSelectMenuProps<RoleSelectMenuInteraction, RoleSelectMenuKit> {
|
|
607
|
-
}
|
|
608
|
-
declare function RoleSelectMenu(props: RoleSelectMenuProps): RoleSelectMenuKit;
|
|
609
|
-
interface MentionableSelectMenuProps extends Partial<Omit<MentionableSelectMenuComponentData, 'type'>>, CommonSelectMenuProps<MentionableSelectMenuInteraction, MentionableSelectMenuKit> {
|
|
610
|
-
}
|
|
611
|
-
declare function MentionableSelectMenu(props: MentionableSelectMenuProps): MentionableSelectMenuKit;
|
|
612
|
-
interface ChannelSelectMenuProps extends Partial<Omit<ChannelSelectMenuComponentData, 'type'>>, CommonSelectMenuProps<ChannelSelectMenuInteraction, ChannelSelectMenuKit> {
|
|
613
|
-
}
|
|
614
|
-
declare function ChannelSelectMenu(props: ChannelSelectMenuProps): ChannelSelectMenuKit;
|
|
615
|
-
|
|
616
|
-
interface ContainerProps extends Omit<ContainerComponentData, 'type' | 'components'> {
|
|
617
|
-
children?: ComponentBuilder[];
|
|
618
|
-
}
|
|
619
|
-
declare function Container(props: ContainerProps): ContainerBuilder;
|
|
620
|
-
|
|
621
|
-
interface FileProps extends Omit<FileComponentData, 'type' | 'file'> {
|
|
622
|
-
url: string;
|
|
623
|
-
}
|
|
624
|
-
declare function File(props: FileProps): FileBuilder;
|
|
625
|
-
|
|
626
|
-
interface MediaGalleryProps {
|
|
627
|
-
id?: number;
|
|
628
|
-
children?: MediaGalleryItemBuilder[];
|
|
629
|
-
}
|
|
630
|
-
declare function MediaGallery(props: MediaGalleryProps): MediaGalleryBuilder;
|
|
631
|
-
interface MediaGalleryItemProps {
|
|
632
|
-
description?: string;
|
|
633
|
-
spoiler?: boolean;
|
|
634
|
-
url?: string;
|
|
635
|
-
}
|
|
636
|
-
declare function MediaGalleryItem(props: MediaGalleryItemProps): MediaGalleryItemBuilder;
|
|
637
|
-
|
|
638
|
-
interface SectionProps {
|
|
639
|
-
children?: (ThumbnailBuilder | ButtonBuilder | TextDisplayBuilder)[];
|
|
640
|
-
id?: number;
|
|
641
|
-
}
|
|
642
|
-
declare function Section(props: SectionProps): SectionBuilder;
|
|
643
|
-
interface ThumbnailProps {
|
|
644
|
-
id?: number;
|
|
645
|
-
description?: string;
|
|
646
|
-
spoiler?: boolean;
|
|
647
|
-
url: string;
|
|
648
|
-
}
|
|
649
|
-
declare function Thumbnail(props: ThumbnailProps): ThumbnailBuilder;
|
|
650
|
-
|
|
651
|
-
interface SeparatorProps extends Omit<SeparatorComponentData, 'type'> {
|
|
652
|
-
}
|
|
653
|
-
declare function Separator(props: SeparatorProps): SeparatorBuilder;
|
|
654
|
-
|
|
655
|
-
type StringEncodable = string | number | boolean;
|
|
656
|
-
interface TextDisplayProps extends Omit<TextDisplayComponentData, 'type' | 'content'> {
|
|
657
|
-
children?: StringEncodable | StringEncodable[];
|
|
658
|
-
content?: string;
|
|
659
|
-
}
|
|
660
|
-
declare function TextDisplay(props: TextDisplayProps): TextDisplayBuilder;
|
|
661
|
-
|
|
662
|
-
interface ParsedMessageCommand {
|
|
663
|
-
command: string;
|
|
664
|
-
options: {
|
|
665
|
-
name: string;
|
|
666
|
-
value: unknown;
|
|
667
|
-
}[];
|
|
668
|
-
subcommand?: string;
|
|
669
|
-
subcommandGroup?: string;
|
|
670
|
-
}
|
|
671
|
-
type MessageCommandOptionsSchema = Record<string, ApplicationCommandOptionType>;
|
|
672
|
-
declare class MessageCommandParser {
|
|
673
|
-
#private;
|
|
674
|
-
message: Message$1;
|
|
675
|
-
private prefix;
|
|
676
|
-
private schema;
|
|
677
|
-
constructor(message: Message$1, prefix: string[], schema: (command: string) => MessageCommandOptionsSchema);
|
|
678
|
-
getArgs(): string[];
|
|
679
|
-
get options(): MessageCommandOptions;
|
|
680
|
-
getOption<T>(name: string): T | undefined;
|
|
681
|
-
getCommand(): string;
|
|
682
|
-
getSubcommand(): string | undefined;
|
|
683
|
-
getSubcommandGroup(): string | undefined;
|
|
684
|
-
getPrefix(): string | undefined;
|
|
685
|
-
getFullCommand(): string;
|
|
686
|
-
parse(): ParsedMessageCommand;
|
|
687
|
-
}
|
|
688
|
-
declare class MessageCommandOptions {
|
|
689
|
-
private parser;
|
|
690
|
-
constructor(parser: MessageCommandParser);
|
|
691
|
-
private assertOption;
|
|
692
|
-
getMember(name: string): GuildMember | null;
|
|
693
|
-
getMember(name: string, required: true): GuildMember;
|
|
694
|
-
getAttachment(name: string): Attachment | null;
|
|
695
|
-
getAttachment(name: string, required: true): Attachment;
|
|
696
|
-
getBoolean(name: string): boolean | null;
|
|
697
|
-
getBoolean(name: string, required: true): boolean;
|
|
698
|
-
getNumber(name: string): number | null;
|
|
699
|
-
getNumber(name: string, required: true): number;
|
|
700
|
-
getString(name: string): string | null;
|
|
701
|
-
getString(name: string, required: true): string;
|
|
702
|
-
getInteger(name: string): number | null;
|
|
703
|
-
getInteger(name: string, required: true): number;
|
|
704
|
-
getUser(name: string): User | null;
|
|
705
|
-
getUser(name: string, required: true): User;
|
|
706
|
-
getChannel(name: string): Channel | null;
|
|
707
|
-
getChannel(name: string, required: true): Channel;
|
|
708
|
-
getRole(name: string): Role | null;
|
|
709
|
-
getRole(name: string, required: true): Role;
|
|
710
|
-
getMentionable(name: string): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null;
|
|
711
|
-
getMentionable(name: string, required: true): NonNullable<CommandInteractionOption['member' | 'role' | 'user']>;
|
|
712
|
-
getSubcommand(): string | null;
|
|
713
|
-
getSubcommand(required: true): string;
|
|
714
|
-
getSubcommandGroup(): string | null;
|
|
715
|
-
getSubcommandGroup(required: true): string;
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
type GenericFunction<A extends any[] = any[]> = (...args: A) => any;
|
|
719
|
-
/**
|
|
720
|
-
* Represents an async function that can be cached
|
|
721
|
-
* @template R - Array of argument types
|
|
722
|
-
* @template T - Return type
|
|
723
|
-
*/
|
|
724
|
-
type AsyncFunction<R extends any[] = any[], T = any> = (...args: R) => Promise<T>;
|
|
725
|
-
declare function exitContext<T>(fn: () => T): T;
|
|
726
|
-
declare function provideContext<R>(value: CommandKitEnvironment, receiver: () => R): R;
|
|
727
|
-
/**
|
|
728
|
-
* Returns a context-aware version of the given function.
|
|
729
|
-
* @param env - The commandkit environment data.
|
|
730
|
-
* @param fn - The target function.
|
|
731
|
-
* @param finalizer - An optional finalizer function to run after the target function. This function will be context-aware.
|
|
732
|
-
* @internal
|
|
733
|
-
*/
|
|
734
|
-
declare function makeContextAwareFunction<R extends GenericFunction, F extends GenericFunction>(env: CommandKitEnvironment, fn: R, finalizer?: F): R;
|
|
735
|
-
/**
|
|
736
|
-
* Retrieves commandkit
|
|
737
|
-
* @private
|
|
738
|
-
* @internal
|
|
739
|
-
*/
|
|
740
|
-
declare function getCommandKit(): CommandKit | undefined;
|
|
741
|
-
declare function getCommandKit(strict: true): CommandKit;
|
|
742
|
-
declare function getCommandKit(strict: false): CommandKit | undefined;
|
|
743
|
-
/**
|
|
744
|
-
* Get the current commandkit context.
|
|
745
|
-
* @internal
|
|
746
|
-
*/
|
|
747
|
-
declare function getContext(): CommandKitEnvironment | undefined;
|
|
748
|
-
/**
|
|
749
|
-
* Use current commandkit context. Throws an error if no context is found.
|
|
750
|
-
*/
|
|
751
|
-
declare function useEnvironment(): CommandKitEnvironment;
|
|
752
|
-
|
|
753
|
-
/**
|
|
754
|
-
* Cancel upcoming middleware execution.
|
|
755
|
-
* If this is called inside pre-stage middleware, the next run will be the actual command, skipping all other pre-stage middlewares.
|
|
756
|
-
* If this is called inside a command itself, it will skip all post-stage middlewares.
|
|
757
|
-
* If this is called inside post-stage middleware, it will skip all other post-stage middlewares.
|
|
758
|
-
*/
|
|
759
|
-
declare function exitMiddleware(): never;
|
|
760
|
-
/**
|
|
761
|
-
* Rethrow the error if it is a CommandKit error.
|
|
762
|
-
* @param error The error to rethrow.
|
|
763
|
-
*/
|
|
764
|
-
declare function rethrow(error: unknown): void;
|
|
765
|
-
/**
|
|
766
|
-
* Stops current command assuming it has been redirected to another command.
|
|
767
|
-
*/
|
|
768
|
-
declare function redirect(): never;
|
|
769
|
-
|
|
770
|
-
interface PreRegisterCommandsEvent {
|
|
771
|
-
preventDefault(): void;
|
|
772
|
-
commands: CommandData[];
|
|
773
|
-
}
|
|
774
|
-
declare class CommandRegistrar {
|
|
775
|
-
readonly commandkit: CommandKit;
|
|
776
|
-
private api;
|
|
777
|
-
/**
|
|
778
|
-
* Creates an instance of CommandRegistrar.
|
|
779
|
-
* @param commandkit The commandkit instance.
|
|
780
|
-
*/
|
|
781
|
-
constructor(commandkit: CommandKit);
|
|
782
|
-
/**
|
|
783
|
-
* Gets the commands data.
|
|
784
|
-
*/
|
|
785
|
-
getCommandsData(): CommandData[];
|
|
786
|
-
/**
|
|
787
|
-
* Registers loaded commands.
|
|
788
|
-
*/
|
|
789
|
-
register(): Promise<void>;
|
|
790
|
-
/**
|
|
791
|
-
* Updates the global commands.
|
|
792
|
-
*/
|
|
793
|
-
updateGlobalCommands(commands: CommandData[]): Promise<void>;
|
|
794
|
-
/**
|
|
795
|
-
* Updates the guild commands.
|
|
796
|
-
*/
|
|
797
|
-
updateGuildCommands(commands: CommandData[]): Promise<void>;
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
type CommandSource = Interaction | Message$1;
|
|
801
|
-
declare function isMessageSource(source: CommandSource): source is Message$1;
|
|
802
|
-
declare function isInteractionSource(source: CommandSource): source is Interaction;
|
|
803
|
-
|
|
804
|
-
interface CommandKitEnvironmentInternalData {
|
|
805
|
-
executionError: Error | null;
|
|
806
|
-
type: CommandKitEnvironmentType | null;
|
|
807
|
-
variables: Map<string, any>;
|
|
808
|
-
deferredFunctions: Map<string, GenericFunction<[CommandKitEnvironment]>>;
|
|
809
|
-
marker: string;
|
|
810
|
-
markStart: number;
|
|
811
|
-
markEnd: number;
|
|
812
|
-
context: Context | null;
|
|
813
|
-
}
|
|
814
|
-
declare class CommandKitEnvironment {
|
|
815
|
-
#private;
|
|
816
|
-
readonly commandkit: CommandKit;
|
|
817
|
-
/**
|
|
818
|
-
* Creates the commandkit execution environment.
|
|
819
|
-
* @param commandkit - The commandkit instance.
|
|
820
|
-
*/
|
|
821
|
-
constructor(commandkit: CommandKit);
|
|
822
|
-
/**
|
|
823
|
-
* Set the context.
|
|
824
|
-
* @param context - The context to set.
|
|
825
|
-
*/
|
|
826
|
-
setContext(context: Context): void;
|
|
827
|
-
/**
|
|
828
|
-
* Get the context. `null` if not set.
|
|
829
|
-
* @internal
|
|
830
|
-
*/
|
|
831
|
-
get context(): Context | null;
|
|
832
|
-
/**
|
|
833
|
-
* Get the execution error.
|
|
834
|
-
* @internal
|
|
835
|
-
*/
|
|
836
|
-
getExecutionError(): Error | null;
|
|
837
|
-
/**
|
|
838
|
-
* Set the execution error.
|
|
839
|
-
* @param error - The error to set.
|
|
840
|
-
* @internal
|
|
841
|
-
*/
|
|
842
|
-
setExecutionError(error: Error): void;
|
|
843
|
-
/**
|
|
844
|
-
* Get the environment type.
|
|
845
|
-
*/
|
|
846
|
-
getType(): CommandKitEnvironmentType;
|
|
847
|
-
/**
|
|
848
|
-
* Set the environment type.
|
|
849
|
-
* @param type - The environment type to set.
|
|
850
|
-
* @internal
|
|
851
|
-
*/
|
|
852
|
-
setType(type: CommandKitEnvironmentType): void;
|
|
853
|
-
/**
|
|
854
|
-
* The variables store for this environment.
|
|
855
|
-
*/
|
|
856
|
-
get variables(): Map<string, any>;
|
|
857
|
-
/**
|
|
858
|
-
* Register a deferred function.
|
|
859
|
-
* @param fn - The deferred function to register.
|
|
860
|
-
* @returns The deferred function id.
|
|
861
|
-
* @internal
|
|
862
|
-
*/
|
|
863
|
-
registerDeferredFunction(fn: GenericFunction<[CommandKitEnvironment]>): string;
|
|
864
|
-
/**
|
|
865
|
-
* Clear a deferred function by id.
|
|
866
|
-
* @param id - The deferred function id to clear.
|
|
867
|
-
* @internal
|
|
868
|
-
*/
|
|
869
|
-
clearDeferredFunction(id: string): void;
|
|
870
|
-
/**
|
|
871
|
-
* Run all deferred functions sequentially.
|
|
872
|
-
* @internal
|
|
873
|
-
*/
|
|
874
|
-
runDeferredFunctions(): Promise<void>;
|
|
875
|
-
/**
|
|
876
|
-
* Clear all deferred functions.
|
|
877
|
-
* @internal
|
|
878
|
-
*/
|
|
879
|
-
clearAllDeferredFunctions(): void;
|
|
880
|
-
/**
|
|
881
|
-
* Mark the start of a command execution.
|
|
882
|
-
* @param marker - The marker to set.
|
|
883
|
-
* @internal
|
|
884
|
-
*/
|
|
885
|
-
markStart(marker: string): void;
|
|
886
|
-
/**
|
|
887
|
-
* Mark the end of a command execution.
|
|
888
|
-
* @internal
|
|
889
|
-
*/
|
|
890
|
-
markEnd(): void;
|
|
891
|
-
/**
|
|
892
|
-
* Get the marker.
|
|
893
|
-
* @internal
|
|
894
|
-
*/
|
|
895
|
-
getMarker(): string;
|
|
896
|
-
/**
|
|
897
|
-
* Get the execution time in milliseconds.
|
|
898
|
-
* @internal
|
|
899
|
-
*/
|
|
900
|
-
getExecutionTime(): number;
|
|
901
|
-
}
|
|
902
|
-
declare enum CommandKitEnvironmentType {
|
|
903
|
-
CommandHandler = "COMMAND_HANDLER"
|
|
904
|
-
}
|
|
905
|
-
/**
|
|
906
|
-
* Runs the given function after the current command has finished executing.
|
|
907
|
-
* @param fn The function to run after the current command.
|
|
908
|
-
* @returns The deferred function id. This can be used to cancel the deferred function.
|
|
909
|
-
*/
|
|
910
|
-
declare function after(fn: GenericFunction<[CommandKitEnvironment]>): string;
|
|
911
|
-
/**
|
|
912
|
-
* Cancels a deferred function registered with `after`.
|
|
913
|
-
* @param id The deferred function id to cancel.
|
|
914
|
-
*/
|
|
915
|
-
declare function cancelAfter(id: string): void;
|
|
916
|
-
|
|
917
|
-
declare const CommandExecutionMode: {
|
|
918
|
-
readonly ChatInputCommand: "chatInput";
|
|
919
|
-
readonly MessageContextMenu: "messageContextMenu";
|
|
920
|
-
readonly UserContextMenu: "userContextMenu";
|
|
921
|
-
readonly Autocomplete: "autocomplete";
|
|
922
|
-
readonly Message: "message";
|
|
923
|
-
};
|
|
924
|
-
type CommandExecutionMode = (typeof CommandExecutionMode)[keyof typeof CommandExecutionMode];
|
|
925
|
-
interface ContextParameters<T extends CommandExecutionMode, Args = Record<string, any>> {
|
|
926
|
-
command: LoadedCommand;
|
|
927
|
-
environment?: CommandKitEnvironment;
|
|
928
|
-
executionMode: T;
|
|
929
|
-
interaction: T extends 'chatInput' ? ChatInputCommandInteraction : T extends 'messageContextMenu' ? MessageContextMenuCommandInteraction : T extends 'userContextMenu' ? UserContextMenuCommandInteraction : T extends 'autocomplete' ? AutocompleteInteraction : never;
|
|
930
|
-
message: T extends 'message' ? Message$1 : never;
|
|
931
|
-
forwarded?: boolean;
|
|
932
|
-
messageCommandParser?: T extends 'message' ? MessageCommandParser : never;
|
|
933
|
-
store?: Map<string, any>;
|
|
934
|
-
customArgs?: Args;
|
|
935
|
-
}
|
|
936
|
-
type MessageCommandContext = Context<'message'>;
|
|
937
|
-
type InteractionCommandContext = Context<'autocomplete' | 'chatInput' | 'messageContextMenu' | 'userContextMenu'>;
|
|
938
|
-
type MessageCommandMiddlewareContext = MiddlewareContext<'message'>;
|
|
939
|
-
type InteractionCommandMiddlewareContext = MiddlewareContext<'autocomplete' | 'chatInput' | 'messageContextMenu' | 'userContextMenu'>;
|
|
940
|
-
type ChatInputCommandContext = Context<'chatInput'>;
|
|
941
|
-
type SlashCommandMiddlewareContext = MiddlewareContext<'chatInput'>;
|
|
942
|
-
type AutocompleteCommandContext = Context<'autocomplete'>;
|
|
943
|
-
type AutocompleteCommandMiddlewareContext = MiddlewareContext<'autocomplete'>;
|
|
944
|
-
type MessageContextMenuCommandContext = Context<'messageContextMenu'>;
|
|
945
|
-
type MessageContextMenuCommandMiddlewareContext = MiddlewareContext<'messageContextMenu'>;
|
|
946
|
-
type UserContextMenuCommandContext = Context<'userContextMenu'>;
|
|
947
|
-
type UserContextMenuCommandMiddlewareContext = MiddlewareContext<'userContextMenu'>;
|
|
948
|
-
type CommandContextOptions<T extends CommandExecutionMode> = T extends 'message' ? MessageCommandOptions : T extends 'chatInput' ? ChatInputCommandInteraction['options'] : T extends 'autocomplete' ? AutocompleteInteraction['options'] : T extends 'messageContextMenu' ? MessageContextMenuCommandInteraction['options'] : T extends 'userContextMenu' ? UserContextMenuCommandInteraction['options'] : never;
|
|
949
|
-
type AnyCommandExecute<ContextType extends Context = Context> = (ctx: ContextType) => Awaitable<unknown>;
|
|
950
|
-
type ChatInputCommand = AnyCommandExecute<ChatInputCommandContext>;
|
|
951
|
-
type AutocompleteCommand = AnyCommandExecute<AutocompleteCommandContext>;
|
|
952
|
-
type MessageContextMenuCommand = AnyCommandExecute<MessageContextMenuCommandContext>;
|
|
953
|
-
type UserContextMenuCommand = AnyCommandExecute<UserContextMenuCommandContext>;
|
|
954
|
-
type MessageCommand = AnyCommandExecute<MessageCommandContext>;
|
|
955
|
-
interface MiddlewareContextArgs {
|
|
956
|
-
setCommandRunner?: GenericFunction<[RunCommand]>;
|
|
957
|
-
}
|
|
958
|
-
declare class Context<ExecutionMode extends CommandExecutionMode = CommandExecutionMode, Args extends Record<string, any> = Record<string, any>> {
|
|
959
|
-
#private;
|
|
960
|
-
readonly commandkit: CommandKit;
|
|
961
|
-
protected readonly config: ContextParameters<ExecutionMode, Args>;
|
|
962
|
-
/**
|
|
963
|
-
* The interaction that triggered the command.
|
|
964
|
-
*/
|
|
965
|
-
readonly interaction: ContextParameters<ExecutionMode>['interaction'];
|
|
966
|
-
/**
|
|
967
|
-
* The message that triggered the command.
|
|
968
|
-
*/
|
|
969
|
-
readonly message: ContextParameters<ExecutionMode>['message'];
|
|
970
|
-
/**
|
|
971
|
-
* The guild where the command was triggered.
|
|
972
|
-
*/
|
|
973
|
-
readonly guild: Guild | null;
|
|
974
|
-
/**
|
|
975
|
-
* The guild ID where the command was triggered.
|
|
976
|
-
*/
|
|
977
|
-
readonly guildId: string | null;
|
|
978
|
-
/**
|
|
979
|
-
* The channel where the command was triggered.
|
|
980
|
-
*/
|
|
981
|
-
readonly channel: TextBasedChannel | null;
|
|
982
|
-
/**
|
|
983
|
-
* The channel id where the command was triggered.
|
|
984
|
-
*/
|
|
985
|
-
readonly channelId: string | null;
|
|
986
|
-
/**
|
|
987
|
-
* The client instance.
|
|
988
|
-
*/
|
|
989
|
-
readonly client: Client;
|
|
990
|
-
/**
|
|
991
|
-
* The command that this context belongs to.
|
|
992
|
-
*/
|
|
993
|
-
readonly command: LoadedCommand;
|
|
994
|
-
private _locale;
|
|
995
|
-
/**
|
|
996
|
-
* Creates a new command context.
|
|
997
|
-
* @param commandkit The command kit instance.
|
|
998
|
-
* @param config The context parameters.
|
|
999
|
-
*/
|
|
1000
|
-
constructor(commandkit: CommandKit, config: ContextParameters<ExecutionMode, Args>);
|
|
1001
|
-
/**
|
|
1002
|
-
* The shared key-value store for this context. This can be used to store data that needs to be shared between middlewares or commands.
|
|
1003
|
-
* This store is shared across all contexts in the same command execution, including the cloned contexts and middleware contexts.
|
|
1004
|
-
*/
|
|
1005
|
-
get store(): Map<string, any>;
|
|
1006
|
-
get commandName(): string;
|
|
1007
|
-
get options(): CommandContextOptions<ExecutionMode>;
|
|
1008
|
-
/**
|
|
1009
|
-
* Whether this context was forwarded from another context. This happens when a command forwards its context to another command.
|
|
1010
|
-
*/
|
|
1011
|
-
get forwarded(): boolean;
|
|
1012
|
-
/**
|
|
1013
|
-
* Forwards the context to another command. The target handler will be the same as current handler.
|
|
1014
|
-
* @param command The command to forward to.
|
|
1015
|
-
*/
|
|
1016
|
-
forwardCommand<C extends ResolvableCommand>(command: C): Promise<never>;
|
|
1017
|
-
/**
|
|
1018
|
-
* The execution mode of the command.
|
|
1019
|
-
*/
|
|
1020
|
-
get executionMode(): ExecutionMode;
|
|
1021
|
-
/**
|
|
1022
|
-
* Whether the command was triggered by an interaction.
|
|
1023
|
-
*/
|
|
1024
|
-
isInteraction(): this is InteractionCommandContext;
|
|
1025
|
-
/**
|
|
1026
|
-
* Whether the command was triggered by a slash command interaction.
|
|
1027
|
-
*/
|
|
1028
|
-
isChatInputCommand(): this is ChatInputCommandContext;
|
|
1029
|
-
/**
|
|
1030
|
-
* Whether the command was triggered by an autocomplete interaction.
|
|
1031
|
-
*/
|
|
1032
|
-
isAutocomplete(): this is AutocompleteCommandContext;
|
|
1033
|
-
/**
|
|
1034
|
-
* Whether the command was triggered by a message context menu interaction.
|
|
1035
|
-
*/
|
|
1036
|
-
isMessageContextMenu(): this is MessageContextMenuCommandContext;
|
|
1037
|
-
/**
|
|
1038
|
-
* Whether the command was triggered by a user context menu interaction.
|
|
1039
|
-
*/
|
|
1040
|
-
isUserContextMenu(): this is UserContextMenuCommandContext;
|
|
1041
|
-
/**
|
|
1042
|
-
* Whether the command was triggered by a message.
|
|
1043
|
-
*/
|
|
1044
|
-
isMessage(): this is Context<'message'>;
|
|
1045
|
-
/**
|
|
1046
|
-
* Returns the command identifier.
|
|
1047
|
-
*/
|
|
1048
|
-
getCommandIdentifier(): string;
|
|
1049
|
-
/**
|
|
1050
|
-
* Returns the locale of the guild where this command was triggered.
|
|
1051
|
-
*/
|
|
1052
|
-
getGuildLocale(): Locale | null;
|
|
1053
|
-
/**
|
|
1054
|
-
* Returns the locale of the user who triggered this command.
|
|
1055
|
-
*/
|
|
1056
|
-
getUserLocale(): Locale | null;
|
|
1057
|
-
/**
|
|
1058
|
-
* Returns the locale for this command.
|
|
1059
|
-
* @param preferUser Whether to prefer the user's locale over the guild's locale.
|
|
1060
|
-
* @returns The locale for this command. If no locale is found, the default locale is returned.
|
|
1061
|
-
*/
|
|
1062
|
-
getLocale(preferUser?: boolean): Locale;
|
|
1063
|
-
/**
|
|
1064
|
-
* Sets the locale for this command.
|
|
1065
|
-
* @param locale The locale to set.
|
|
1066
|
-
*/
|
|
1067
|
-
setLocale(locale: Locale | null): void;
|
|
1068
|
-
/**
|
|
1069
|
-
* Creates a clone of this context
|
|
1070
|
-
*/
|
|
1071
|
-
clone(config?: Partial<ContextParameters<ExecutionMode>>): Context<ExecutionMode>;
|
|
1072
|
-
isMiddleware(): this is MiddlewareContext<ExecutionMode>;
|
|
1073
|
-
args(): string[];
|
|
1074
|
-
/**
|
|
1075
|
-
* Stops upcoming middleware or current command execution.
|
|
1076
|
-
* If this is called inside pre-stage middleware, the next run will be the actual command, skipping all other pre-stage middlewares.
|
|
1077
|
-
* If this is called inside a command itself, it will skip all post-stage middlewares.
|
|
1078
|
-
* If this is called inside post-stage middleware, it will skip all other post-stage middlewares.
|
|
1079
|
-
*/
|
|
1080
|
-
exit(): never;
|
|
1081
|
-
}
|
|
1082
|
-
declare class MiddlewareContext<T extends CommandExecutionMode = CommandExecutionMode> extends Context<T, MiddlewareContextArgs> {
|
|
1083
|
-
#private;
|
|
1084
|
-
/**
|
|
1085
|
-
* Whether the command execution was cancelled.
|
|
1086
|
-
*/
|
|
1087
|
-
get cancelled(): boolean;
|
|
1088
|
-
/**
|
|
1089
|
-
* Cancels the command execution.
|
|
1090
|
-
*/
|
|
1091
|
-
cancel(): void;
|
|
1092
|
-
/**
|
|
1093
|
-
* Sets command runner function to wrap the command execution.
|
|
1094
|
-
* @param fn The function to set.
|
|
1095
|
-
* @example ctx.setCommandRunner(async (execute) => {
|
|
1096
|
-
* // do something before command execution
|
|
1097
|
-
* await execute();
|
|
1098
|
-
* // do something after command execution
|
|
1099
|
-
* })
|
|
1100
|
-
*/
|
|
1101
|
-
setCommandRunner(fn: RunCommand): void;
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
interface Command {
|
|
1105
|
-
id: string;
|
|
1106
|
-
name: string;
|
|
1107
|
-
path: string;
|
|
1108
|
-
relativePath: string;
|
|
1109
|
-
parentPath: string;
|
|
1110
|
-
middlewares: Array<string>;
|
|
1111
|
-
category: string | null;
|
|
1112
|
-
}
|
|
1113
|
-
interface Middleware {
|
|
1114
|
-
id: string;
|
|
1115
|
-
name: string;
|
|
1116
|
-
path: string;
|
|
1117
|
-
relativePath: string;
|
|
1118
|
-
parentPath: string;
|
|
1119
|
-
global: boolean;
|
|
1120
|
-
command: string | null;
|
|
1121
|
-
}
|
|
1122
|
-
interface ParsedCommandData {
|
|
1123
|
-
commands: Record<string, Command>;
|
|
1124
|
-
middlewares: Record<string, Middleware>;
|
|
1125
|
-
}
|
|
1126
|
-
interface CommandsRouterOptions {
|
|
1127
|
-
entrypoint: string;
|
|
1128
|
-
}
|
|
1129
|
-
declare class CommandsRouter {
|
|
1130
|
-
private readonly options;
|
|
1131
|
-
private commands;
|
|
1132
|
-
private middlewares;
|
|
1133
|
-
constructor(options: CommandsRouterOptions);
|
|
1134
|
-
populate(data: ParsedCommandData): void;
|
|
1135
|
-
isValidPath(): boolean;
|
|
1136
|
-
private isCommand;
|
|
1137
|
-
private isMiddleware;
|
|
1138
|
-
private isCategory;
|
|
1139
|
-
clear(): void;
|
|
1140
|
-
scan(): Promise<{
|
|
1141
|
-
commands: {
|
|
1142
|
-
[k: string]: Command;
|
|
1143
|
-
};
|
|
1144
|
-
middlewares: {
|
|
1145
|
-
[k: string]: Middleware;
|
|
1146
|
-
};
|
|
1147
|
-
}>;
|
|
1148
|
-
getData(): {
|
|
1149
|
-
commands: Collection<string, Command>;
|
|
1150
|
-
middlewares: Collection<string, Middleware>;
|
|
1151
|
-
};
|
|
1152
|
-
toJSON(): {
|
|
1153
|
-
commands: {
|
|
1154
|
-
[k: string]: Command;
|
|
1155
|
-
};
|
|
1156
|
-
middlewares: {
|
|
1157
|
-
[k: string]: Middleware;
|
|
1158
|
-
};
|
|
1159
|
-
};
|
|
1160
|
-
private traverse;
|
|
1161
|
-
private handle;
|
|
1162
|
-
private applyMiddlewares;
|
|
1163
|
-
private replaceEntrypoint;
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
/**
|
|
1167
|
-
* Configuration options for the EventsRouter
|
|
1168
|
-
* @interface EventsRouterOptions
|
|
1169
|
-
*/
|
|
1170
|
-
interface EventsRouterOptions {
|
|
1171
|
-
/** Root directory path where event handlers are located */
|
|
1172
|
-
entrypoints: string[];
|
|
1173
|
-
}
|
|
1174
|
-
/**
|
|
1175
|
-
* Represents a parsed event with its handlers
|
|
1176
|
-
* @interface ParsedEvent
|
|
1177
|
-
*/
|
|
1178
|
-
interface ParsedEvent {
|
|
1179
|
-
/** Name of the event derived from directory name */
|
|
1180
|
-
event: string;
|
|
1181
|
-
/** Absolute path to the event directory */
|
|
1182
|
-
path: string;
|
|
1183
|
-
/** Array of file paths to event listener handlers */
|
|
1184
|
-
listeners: string[];
|
|
1185
|
-
/** Namespace of the event */
|
|
1186
|
-
namespace: string | null;
|
|
1187
|
-
}
|
|
1188
|
-
/** Collection of event names to their parsed metadata */
|
|
1189
|
-
type EventsTree = Record<string, ParsedEvent>;
|
|
1190
|
-
/**
|
|
1191
|
-
* Router for discovering and managing event handler files in a directory structure.
|
|
1192
|
-
* Events are represented by directories, and handlers are files within those directories.
|
|
1193
|
-
*/
|
|
1194
|
-
declare class EventsRouter {
|
|
1195
|
-
private options;
|
|
1196
|
-
/** Internal storage of parsed events */
|
|
1197
|
-
private events;
|
|
1198
|
-
/**
|
|
1199
|
-
* Creates a new EventsRouter instance
|
|
1200
|
-
* @param options - Configuration options for the router
|
|
1201
|
-
* @throws Error if entrypoint is not provided
|
|
1202
|
-
*/
|
|
1203
|
-
constructor(options: EventsRouterOptions);
|
|
1204
|
-
/**
|
|
1205
|
-
* Adds new entrypoints to the router
|
|
1206
|
-
* @param entrypoints - Array of new entrypoint paths
|
|
1207
|
-
*/
|
|
1208
|
-
addEntrypoints(entrypoints: string[]): void;
|
|
1209
|
-
/**
|
|
1210
|
-
* Find a parsed event by its name
|
|
1211
|
-
* @param event - Name of the event to find
|
|
1212
|
-
* @returns Parsed event metadata or null if not found
|
|
1213
|
-
*/
|
|
1214
|
-
match(event: string): ParsedEvent | null;
|
|
1215
|
-
/**
|
|
1216
|
-
* Get the entrypoint directory path
|
|
1217
|
-
* @returns Entrypoint directory path
|
|
1218
|
-
*/
|
|
1219
|
-
get entrypoints(): string[];
|
|
1220
|
-
/**
|
|
1221
|
-
* Checks if the entrypoint path is valid
|
|
1222
|
-
*/
|
|
1223
|
-
isValidPath(): boolean;
|
|
1224
|
-
/**
|
|
1225
|
-
* Clear all parsed events
|
|
1226
|
-
*/
|
|
1227
|
-
clear(): void;
|
|
1228
|
-
/**
|
|
1229
|
-
* Reload and re-scan the entrypoint directory for events
|
|
1230
|
-
* @returns Promise resolving to the updated events tree
|
|
1231
|
-
*/
|
|
1232
|
-
reload(): Promise<EventsTree>;
|
|
1233
|
-
/**
|
|
1234
|
-
* Scan the entrypoint directory for events and their handlers
|
|
1235
|
-
* @returns Promise resolving to the events tree
|
|
1236
|
-
*/
|
|
1237
|
-
scan(): Promise<EventsTree>;
|
|
1238
|
-
/**
|
|
1239
|
-
* Convert the internal events Collection to a plain object
|
|
1240
|
-
* @returns Events tree as a plain object
|
|
1241
|
-
*/
|
|
1242
|
-
toJSON(): EventsTree;
|
|
1243
|
-
/**
|
|
1244
|
-
* Recursively scan a directory for event handlers
|
|
1245
|
-
* @param event - Name of the event
|
|
1246
|
-
* @param path - Path to the event directory
|
|
1247
|
-
* @param listeners - Array to collect listener file paths
|
|
1248
|
-
* @returns Promise resolving to the parsed event metadata
|
|
1249
|
-
*/
|
|
1250
|
-
private scanEvent;
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
declare class AppCommandRunner {
|
|
1254
|
-
#private;
|
|
1255
|
-
private handler;
|
|
1256
|
-
constructor(handler: AppCommandHandler);
|
|
1257
|
-
runCommand(prepared: PreparedAppCommandExecution, source: Interaction | Message$1): Promise<void>;
|
|
1258
|
-
getExecutionMode(source: Interaction | Message$1): CommandExecutionMode;
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
type RunCommand = <T extends AsyncFunction>(fn: T) => T;
|
|
1262
|
-
interface AppCommand {
|
|
1263
|
-
command: SlashCommandBuilder | Record<string, any>;
|
|
1264
|
-
chatInput?: (ctx: Context) => Awaitable<unknown>;
|
|
1265
|
-
autocomplete?: (ctx: Context) => Awaitable<unknown>;
|
|
1266
|
-
message?: (ctx: Context) => Awaitable<unknown>;
|
|
1267
|
-
messageContextMenu?: (ctx: Context) => Awaitable<unknown>;
|
|
1268
|
-
userContextMenu?: (ctx: Context) => Awaitable<unknown>;
|
|
1269
|
-
}
|
|
1270
|
-
interface AppCommandMiddleware {
|
|
1271
|
-
beforeExecute: (ctx: Context) => Awaitable<unknown>;
|
|
1272
|
-
afterExecute: (ctx: Context) => Awaitable<unknown>;
|
|
1273
|
-
}
|
|
1274
|
-
interface LoadedCommand {
|
|
1275
|
-
command: Command;
|
|
1276
|
-
data: AppCommand;
|
|
1277
|
-
guilds?: string[];
|
|
1278
|
-
}
|
|
1279
|
-
type CommandTypeData = string;
|
|
1280
|
-
type ResolvableCommand = CommandTypeData | (string & {});
|
|
1281
|
-
interface LoadedMiddleware {
|
|
1282
|
-
middleware: Middleware;
|
|
1283
|
-
data: AppCommandMiddleware;
|
|
1284
|
-
}
|
|
1285
|
-
interface PreparedAppCommandExecution {
|
|
1286
|
-
command: LoadedCommand;
|
|
1287
|
-
middlewares: LoadedMiddleware[];
|
|
1288
|
-
messageCommandParser?: MessageCommandParser;
|
|
1289
|
-
}
|
|
1290
|
-
type CommandBuilderLike = SlashCommandBuilder | ContextMenuCommandBuilder | Record<string, any>;
|
|
1291
|
-
declare class AppCommandHandler {
|
|
1292
|
-
readonly commandkit: CommandKit;
|
|
1293
|
-
private loadedCommands;
|
|
1294
|
-
private loadedMiddlewares;
|
|
1295
|
-
private commandNameToId;
|
|
1296
|
-
private subcommandPathToId;
|
|
1297
|
-
readonly registrar: CommandRegistrar;
|
|
1298
|
-
private onInteraction;
|
|
1299
|
-
private onMessageCreate;
|
|
1300
|
-
readonly commandRunner: AppCommandRunner;
|
|
1301
|
-
readonly externalCommandData: Collection<string, Command>;
|
|
1302
|
-
readonly externalMiddlewareData: Collection<string, Middleware>;
|
|
1303
|
-
constructor(commandkit: CommandKit);
|
|
1304
|
-
printBanner(): void;
|
|
1305
|
-
getCommandsArray(): LoadedCommand[];
|
|
1306
|
-
registerCommandHandler(): void;
|
|
1307
|
-
prepareCommandRun(source: Interaction | Message$1, cmdName?: string): Promise<PreparedAppCommandExecution | null>;
|
|
1308
|
-
reloadCommands(): Promise<void>;
|
|
1309
|
-
addExternalMiddleware(data: Middleware[]): Promise<void>;
|
|
1310
|
-
addExternalCommands(data: Command[]): Promise<void>;
|
|
1311
|
-
registerExternalLoadedMiddleware(data: LoadedMiddleware[]): Promise<void>;
|
|
1312
|
-
registerExternalLoadedCommands(data: LoadedCommand[]): Promise<void>;
|
|
1313
|
-
loadCommands(): Promise<void>;
|
|
1314
|
-
private loadMiddleware;
|
|
1315
|
-
private loadCommand;
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
type ListenerFunction = GenericFunction | AsyncFunction;
|
|
1319
|
-
declare class CommandKitEventsChannel {
|
|
1320
|
-
readonly commandkit: CommandKit;
|
|
1321
|
-
private emitter;
|
|
1322
|
-
constructor(commandkit: CommandKit);
|
|
1323
|
-
to(namespace: string): {
|
|
1324
|
-
on: (event: string, listener: ListenerFunction) => void;
|
|
1325
|
-
off: (event: string, listener: ListenerFunction) => void;
|
|
1326
|
-
once: (event: string, listener: ListenerFunction) => void;
|
|
1327
|
-
emit: (event: string, ...args: any[]) => boolean;
|
|
1328
|
-
removeAllListeners: (event: string) => void;
|
|
1329
|
-
};
|
|
1330
|
-
on(namespace: string, event: string, listener: ListenerFunction): void;
|
|
1331
|
-
off(namespace: string, event: string, listener: ListenerFunction): void;
|
|
1332
|
-
once(namespace: string, event: string, listener: ListenerFunction): void;
|
|
1333
|
-
emit(namespace: string, event: string, ...args: any[]): boolean;
|
|
1334
|
-
removeAllListeners(namespace: string): void;
|
|
1335
|
-
removeAllListeners(namespace: string, event: string): void;
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
interface AppEventsHandlerLoadedData {
|
|
1339
|
-
name: string;
|
|
1340
|
-
namespace: string | null;
|
|
1341
|
-
onceListeners: number;
|
|
1342
|
-
regularListeners: number;
|
|
1343
|
-
metadata: ParsedEvent;
|
|
1344
|
-
}
|
|
1345
|
-
declare class AppEventsHandler {
|
|
1346
|
-
readonly commandkit: CommandKit;
|
|
1347
|
-
private loadedEvents;
|
|
1348
|
-
constructor(commandkit: CommandKit);
|
|
1349
|
-
getEvents(): AppEventsHandlerLoadedData[];
|
|
1350
|
-
reloadEvents(): Promise<void>;
|
|
1351
|
-
loadEvents(): Promise<void>;
|
|
1352
|
-
unregisterAll(): void;
|
|
1353
|
-
registerAllClientEvents(): void;
|
|
1354
|
-
unregisterAllClientListeners(): void;
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
interface OnLoadArgs {
|
|
1358
|
-
path: string;
|
|
1359
|
-
namespace: string;
|
|
1360
|
-
suffix: string;
|
|
1361
|
-
pluginData: any;
|
|
1362
|
-
with: Record<string, string>;
|
|
1363
|
-
}
|
|
1364
|
-
interface OnLoadOptions {
|
|
1365
|
-
filter: RegExp;
|
|
1366
|
-
namespace?: string;
|
|
1367
|
-
}
|
|
1368
|
-
type Loader = `${'j' | 't'}s` | (string & {});
|
|
1369
|
-
interface OnLoadResult {
|
|
1370
|
-
contents?: string | Uint8Array;
|
|
1371
|
-
errors?: Message[];
|
|
1372
|
-
loader?: Loader;
|
|
1373
|
-
pluginData?: any;
|
|
1374
|
-
pluginName?: string;
|
|
1375
|
-
resolveDir?: string;
|
|
1376
|
-
warnings?: Message[];
|
|
1377
|
-
watchDirs?: string[];
|
|
1378
|
-
watchFiles?: string[];
|
|
1379
|
-
}
|
|
1380
|
-
interface Message {
|
|
1381
|
-
text: string;
|
|
1382
|
-
location: Location | null;
|
|
1383
|
-
detail: any;
|
|
1384
|
-
}
|
|
1385
|
-
interface Location {
|
|
1386
|
-
file: string;
|
|
1387
|
-
namespace: string;
|
|
1388
|
-
line: number;
|
|
1389
|
-
column: number;
|
|
1390
|
-
length: number;
|
|
1391
|
-
lineText: string;
|
|
1392
|
-
}
|
|
1393
|
-
interface OnResolveOptions {
|
|
1394
|
-
filter: RegExp;
|
|
1395
|
-
namespace?: string;
|
|
1396
|
-
}
|
|
1397
|
-
interface OnResolveArgs {
|
|
1398
|
-
path: string;
|
|
1399
|
-
importer: string;
|
|
1400
|
-
namespace: string;
|
|
1401
|
-
resolveDir: string;
|
|
1402
|
-
kind: ResolveKind;
|
|
1403
|
-
pluginData: any;
|
|
1404
|
-
with: Record<string, string>;
|
|
1405
|
-
}
|
|
1406
|
-
type ResolveKind = 'entry-point' | 'import-statement' | 'require-call' | 'dynamic-import' | 'require-resolve' | 'import-rule' | 'composes-from' | 'url-token';
|
|
1407
|
-
interface OnResolveResult {
|
|
1408
|
-
errors?: Message[];
|
|
1409
|
-
external?: boolean;
|
|
1410
|
-
namespace?: string;
|
|
1411
|
-
path?: string;
|
|
1412
|
-
pluginData?: any;
|
|
1413
|
-
pluginName?: string;
|
|
1414
|
-
sideEffects?: boolean;
|
|
1415
|
-
suffix?: string;
|
|
1416
|
-
warnings?: Message[];
|
|
1417
|
-
watchDirs?: string[];
|
|
1418
|
-
watchFiles?: string[];
|
|
1419
|
-
}
|
|
1420
|
-
interface Setup {
|
|
1421
|
-
onStart(fn: () => Promise<void>): void;
|
|
1422
|
-
onEnd(fn: () => Promise<void>): void;
|
|
1423
|
-
onDispose(fn: () => Promise<void>): void;
|
|
1424
|
-
onLoad(options: OnLoadOptions, cb: (args: OnLoadArgs) => Promise<OnLoadResult>): Promise<any>;
|
|
1425
|
-
onResolve(options: OnResolveOptions, cb: (args: OnResolveArgs) => Promise<OnResolveResult>): Promise<any>;
|
|
1426
|
-
}
|
|
1427
|
-
|
|
1428
|
-
declare const COMMANDKIT_CACHE_TAG: unique symbol;
|
|
1429
|
-
declare const COMMANDKIT_IS_DEV: boolean;
|
|
1430
|
-
declare const COMMANDKIT_IS_TEST: boolean;
|
|
1431
|
-
declare const COMMANDKIT_BOOTSTRAP_MODE: "development" | "production";
|
|
1432
|
-
/**
|
|
1433
|
-
* Types of Hot Module Replacement events
|
|
1434
|
-
*/
|
|
1435
|
-
declare const HMREventType: {
|
|
1436
|
-
readonly ReloadCommands: "reload-commands";
|
|
1437
|
-
readonly ReloadEvents: "reload-events";
|
|
1438
|
-
readonly Unknown: "unknown";
|
|
1439
|
-
};
|
|
1440
|
-
type HMREventType = (typeof HMREventType)[keyof typeof HMREventType];
|
|
1441
|
-
|
|
1442
|
-
interface CommandKitHMREvent {
|
|
1443
|
-
event: HMREventType;
|
|
1444
|
-
path: string;
|
|
1445
|
-
accept: () => void;
|
|
1446
|
-
preventDefault: () => void;
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
declare abstract class RuntimePlugin<T extends PluginOptions = PluginOptions> extends PluginCommon<T, CommandKitPluginRuntime> {
|
|
1450
|
-
readonly type = PluginType.Runtime;
|
|
1451
|
-
/**
|
|
1452
|
-
* Called before commands are loaded
|
|
1453
|
-
*/
|
|
1454
|
-
onBeforeCommandsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1455
|
-
/**
|
|
1456
|
-
* Called after commands are loaded
|
|
1457
|
-
*/
|
|
1458
|
-
onAfterCommandsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1459
|
-
/**
|
|
1460
|
-
* Called before events are loaded
|
|
1461
|
-
*/
|
|
1462
|
-
onBeforeEventsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1463
|
-
/**
|
|
1464
|
-
* Called after events are loaded
|
|
1465
|
-
*/
|
|
1466
|
-
onAfterEventsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1467
|
-
/**
|
|
1468
|
-
* Called before the client logs in
|
|
1469
|
-
*/
|
|
1470
|
-
onBeforeClientLogin(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1471
|
-
/**
|
|
1472
|
-
* Called after the client logs in
|
|
1473
|
-
*/
|
|
1474
|
-
onAfterClientLogin(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1475
|
-
/**
|
|
1476
|
-
* Called before interaction is handled
|
|
1477
|
-
* @param interaction The interaction
|
|
1478
|
-
*/
|
|
1479
|
-
onBeforeInteraction(ctx: CommandKitPluginRuntime, interaction: Interaction): Promise<void>;
|
|
1480
|
-
/**
|
|
1481
|
-
* Called before message command is processed
|
|
1482
|
-
* @param message The message
|
|
1483
|
-
*/
|
|
1484
|
-
onBeforeMessageCommand(ctx: CommandKitPluginRuntime, message: Message$1): Promise<void>;
|
|
1485
|
-
/**
|
|
1486
|
-
* Called before command is executed. This method can execute the command itself.
|
|
1487
|
-
* @param source The source that triggered the command
|
|
1488
|
-
* @param command The command
|
|
1489
|
-
* @param execute The function that executes the command
|
|
1490
|
-
*/
|
|
1491
|
-
executeCommand(ctx: CommandKitPluginRuntime, env: CommandKitEnvironment, source: Interaction | Message$1, command: PreparedAppCommandExecution, execute: () => Promise<any>): Promise<boolean>;
|
|
1492
|
-
/**
|
|
1493
|
-
* Called after events router is initialized
|
|
1494
|
-
* @param ctx The context
|
|
1495
|
-
*/
|
|
1496
|
-
onEventsRouterInit(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1497
|
-
/**
|
|
1498
|
-
* Called after commands router is initialized
|
|
1499
|
-
* @param ctx The context
|
|
1500
|
-
*/
|
|
1501
|
-
onCommandsRouterInit(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1502
|
-
/**
|
|
1503
|
-
* Called when HMR event is received
|
|
1504
|
-
* @param ctx The context
|
|
1505
|
-
* @param event The event
|
|
1506
|
-
*/
|
|
1507
|
-
performHMR(ctx: CommandKitPluginRuntime, event: CommandKitHMREvent): Promise<void>;
|
|
1508
|
-
/**
|
|
1509
|
-
* Called before command is loaded for registration. This method can be used to modify the command data before it is loaded.
|
|
1510
|
-
* @param ctx The context
|
|
1511
|
-
* @param commands The command that is being loaded. This is a CommandBuilderLike object which represents Discord's command
|
|
1512
|
-
*/
|
|
1513
|
-
prepareCommand(ctx: CommandKitPluginRuntime, commands: CommandBuilderLike): Promise<CommandBuilderLike | null>;
|
|
1514
|
-
/**
|
|
1515
|
-
* Called before command is registered to discord. This method can cancel the registration of the command and handle it manually.
|
|
1516
|
-
* @param ctx The context
|
|
1517
|
-
* @param data The command registration data
|
|
1518
|
-
*/
|
|
1519
|
-
onBeforeRegisterCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
1520
|
-
/**
|
|
1521
|
-
* Called before global commands registration. This method can cancel the registration of the command and handle it manually.
|
|
1522
|
-
* This method is called after `onBeforeRegisterCommands` if that stage was not handled.
|
|
1523
|
-
* @param ctx The context
|
|
1524
|
-
* @param event The command registration data
|
|
1525
|
-
*/
|
|
1526
|
-
onBeforeRegisterGlobalCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
1527
|
-
/**
|
|
1528
|
-
* Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
|
|
1529
|
-
* This method is called before guilds of the command are resolved. It is called after `onBeforeRegisterCommands` if that stage was not handled.
|
|
1530
|
-
* @param ctx The context
|
|
1531
|
-
* @param event The command registration data
|
|
1532
|
-
*/
|
|
1533
|
-
onBeforePrepareGuildCommandsRegistration(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
1534
|
-
/**
|
|
1535
|
-
* Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
|
|
1536
|
-
* This method is called after guilds of the command are resolved. It is called after `onBeforePrepareGuildCommandsRegistration` if that stage was not handled.
|
|
1537
|
-
* @param ctx The context
|
|
1538
|
-
* @param event The command registration data
|
|
1539
|
-
*/
|
|
1540
|
-
onBeforeRegisterGuildCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
1541
|
-
/**
|
|
1542
|
-
* Called after command and all of its deferred functions are executed.
|
|
1543
|
-
* @param ctx The context
|
|
1544
|
-
* @param env The environment of the command. This environment contains the command execution data such as command context and more.
|
|
1545
|
-
*/
|
|
1546
|
-
onAfterCommand(ctx: CommandKitPluginRuntime, env: CommandKitEnvironment): Promise<void>;
|
|
1547
|
-
/**
|
|
1548
|
-
* Called before emitting an event
|
|
1549
|
-
* @param ctx The context
|
|
1550
|
-
* @param event The event that is being emitted
|
|
1551
|
-
*/
|
|
1552
|
-
willEmitEvent(ctx: CommandKitPluginRuntime, event: CommandKitEventDispatch): Promise<void>;
|
|
1553
|
-
}
|
|
1554
|
-
declare function isRuntimePlugin(plugin: unknown): plugin is RuntimePlugin;
|
|
1555
|
-
|
|
1556
|
-
type CommandKitPlugin = RuntimePlugin | CompilerPlugin;
|
|
1557
|
-
type MaybeFalsey<T> = T | false | null | undefined;
|
|
1558
|
-
interface CommandKitEventDispatch {
|
|
1559
|
-
name: string;
|
|
1560
|
-
args: unknown[];
|
|
1561
|
-
namespace: string | null;
|
|
1562
|
-
once: boolean;
|
|
1563
|
-
metadata: ParsedEvent;
|
|
1564
|
-
accept(): void;
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
interface PluginTransformParameters {
|
|
1568
|
-
args: OnLoadArgs;
|
|
1569
|
-
path: string;
|
|
1570
|
-
contents: string | Uint8Array;
|
|
1571
|
-
loader?: Loader;
|
|
1572
|
-
}
|
|
1573
|
-
interface TransformedResult {
|
|
1574
|
-
contents?: string | Uint8Array;
|
|
1575
|
-
loader?: Loader;
|
|
1576
|
-
}
|
|
1577
|
-
interface ResolveResult {
|
|
1578
|
-
path?: string;
|
|
1579
|
-
external?: boolean;
|
|
1580
|
-
}
|
|
1581
|
-
declare abstract class CompilerPlugin<T extends PluginOptions = PluginOptions> extends PluginCommon<T, CompilerPluginRuntime> {
|
|
1582
|
-
readonly type = PluginType.Compiler;
|
|
1583
|
-
/**
|
|
1584
|
-
* Called when transformation is requested to this plugin
|
|
1585
|
-
* @param params The parameters for the transformation
|
|
1586
|
-
* @returns The transformed result
|
|
1587
|
-
*/
|
|
1588
|
-
transform(params: PluginTransformParameters): Promise<MaybeFalsey<TransformedResult>>;
|
|
1589
|
-
/**
|
|
1590
|
-
* Called when a resolve is requested to this plugin
|
|
1591
|
-
* @param args The arguments for the resolve
|
|
1592
|
-
* @returns The resolved result
|
|
1593
|
-
*/
|
|
1594
|
-
resolve(args: OnResolveArgs): Promise<MaybeFalsey<ResolveResult>>;
|
|
1595
|
-
/**
|
|
1596
|
-
* Called when a build is started
|
|
1597
|
-
*/
|
|
1598
|
-
onBuildStart(): Promise<void>;
|
|
1599
|
-
/**
|
|
1600
|
-
* Called when a build is ended
|
|
1601
|
-
*/
|
|
1602
|
-
onBuildEnd(): Promise<void>;
|
|
1603
|
-
}
|
|
1604
|
-
declare function isCompilerPlugin(plugin: unknown): plugin is CompilerPlugin;
|
|
1605
|
-
|
|
1606
|
-
type CommonDirectiveTransformerOptions = DirectiveTransformerOptions & {
|
|
1607
|
-
enabled?: boolean;
|
|
1608
|
-
};
|
|
1609
|
-
declare abstract class CommonDirectiveTransformer extends CompilerPlugin<CommonDirectiveTransformerOptions> {
|
|
1610
|
-
private transformer;
|
|
1611
|
-
activate(ctx: CompilerPluginRuntime): Promise<void>;
|
|
1612
|
-
deactivate(ctx: CompilerPluginRuntime): Promise<void>;
|
|
1613
|
-
transform(params: PluginTransformParameters): Promise<MaybeFalsey<TransformedResult>>;
|
|
1614
|
-
}
|
|
1615
|
-
|
|
1616
|
-
declare class CompilerPluginRuntime {
|
|
1617
|
-
private readonly plugins;
|
|
1618
|
-
readonly name = "CompilerPluginRuntime";
|
|
1619
|
-
constructor(plugins: CompilerPlugin[]);
|
|
1620
|
-
getPlugins(): CompilerPlugin<PluginOptions>[];
|
|
1621
|
-
isEmpty(): boolean;
|
|
1622
|
-
private onLoad;
|
|
1623
|
-
private onResolve;
|
|
1624
|
-
private onStart;
|
|
1625
|
-
private onEnd;
|
|
1626
|
-
private onDispose;
|
|
1627
|
-
private onInit;
|
|
1628
|
-
cleanup(): Promise<void>;
|
|
1629
|
-
setup(build: Setup): Promise<void>;
|
|
1630
|
-
toEsbuildPlugin(): {
|
|
1631
|
-
name: string;
|
|
1632
|
-
setup: (build: Setup) => Promise<void>;
|
|
1633
|
-
};
|
|
1634
|
-
}
|
|
1635
|
-
declare function fromEsbuildPlugin(plugin: any): typeof CompilerPlugin;
|
|
1636
|
-
|
|
1637
|
-
type CommonPluginRuntime = CommandKitPluginRuntime | CompilerPluginRuntime;
|
|
1638
|
-
|
|
1639
|
-
type PluginOptions = Record<string, any>;
|
|
1640
|
-
declare enum PluginType {
|
|
1641
|
-
Compiler = "compiler",
|
|
1642
|
-
Runtime = "runtime"
|
|
1643
|
-
}
|
|
1644
|
-
declare abstract class PluginCommon<T extends PluginOptions = PluginOptions, C extends CommonPluginRuntime = CommonPluginRuntime> {
|
|
1645
|
-
protected readonly options: T;
|
|
1646
|
-
abstract readonly type: PluginType;
|
|
1647
|
-
readonly id: `${string}-${string}-${string}-${string}-${string}`;
|
|
1648
|
-
readonly loadedAt: number;
|
|
1649
|
-
abstract readonly name: string;
|
|
1650
|
-
constructor(options: T);
|
|
1651
|
-
/**
|
|
1652
|
-
* Called when this plugin is activated
|
|
1653
|
-
*/
|
|
1654
|
-
activate(ctx: C): Promise<void>;
|
|
1655
|
-
/**
|
|
1656
|
-
* Called when this plugin is deactivated
|
|
1657
|
-
*/
|
|
1658
|
-
deactivate(ctx: C): Promise<void>;
|
|
1659
|
-
}
|
|
1660
|
-
|
|
1661
|
-
declare class CommandKitPluginRuntime {
|
|
1662
|
-
readonly commandkit: CommandKit;
|
|
1663
|
-
private plugins;
|
|
1664
|
-
constructor(commandkit: CommandKit);
|
|
1665
|
-
getPlugins(): Collection<string, RuntimePlugin<PluginOptions>>;
|
|
1666
|
-
getPlugin(pluginName: string): RuntimePlugin | null;
|
|
1667
|
-
softRegisterPlugin(plugin: RuntimePlugin): Promise<void>;
|
|
1668
|
-
registerPlugin(plugin: RuntimePlugin): Promise<void>;
|
|
1669
|
-
unregisterPlugin(plugin: RuntimePlugin): Promise<void>;
|
|
1670
|
-
unregisterAllPlugins(): Promise<void>;
|
|
1671
|
-
capture(): void;
|
|
1672
|
-
execute<R = any>(f: AsyncFunction<[CommandKitPluginRuntime, RuntimePlugin], R | undefined>): Promise<true | R | undefined>;
|
|
1673
|
-
}
|
|
1674
|
-
|
|
1675
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
1676
|
-
type IdentifyFunction<R> = (context: EvaluationContext) => MaybePromise<R>;
|
|
1677
|
-
type DecideFunction<E, R> = (data: {
|
|
1678
|
-
entities: E;
|
|
1679
|
-
}) => MaybePromise<R>;
|
|
1680
|
-
interface FeatureFlagDefinition<R, Entity> {
|
|
1681
|
-
key: string;
|
|
1682
|
-
description?: string;
|
|
1683
|
-
identify?: IdentifyFunction<Entity>;
|
|
1684
|
-
decide: DecideFunction<Entity, R>;
|
|
1685
|
-
}
|
|
1686
|
-
interface CommandFlagContext {
|
|
1687
|
-
client: Client<true>;
|
|
1688
|
-
commandkit: CommandKit;
|
|
1689
|
-
command: {
|
|
1690
|
-
interaction?: ChatInputCommandInteraction | AutocompleteInteraction | ContextMenuCommandInteraction;
|
|
1691
|
-
message?: Message$1;
|
|
1692
|
-
guild: Guild | null;
|
|
1693
|
-
channel: TextBasedChannel | null;
|
|
1694
|
-
command: LoadedCommand;
|
|
1695
|
-
};
|
|
1696
|
-
event: null;
|
|
1697
|
-
}
|
|
1698
|
-
interface EventFlagContext {
|
|
1699
|
-
client: Client<true>;
|
|
1700
|
-
commandkit: CommandKit;
|
|
1701
|
-
event: {
|
|
1702
|
-
data: ParsedEvent;
|
|
1703
|
-
event: string;
|
|
1704
|
-
namespace: string | null;
|
|
1705
|
-
arguments: any[];
|
|
1706
|
-
argumentsAs<E extends keyof ClientEvents>(event: E): ClientEvents[E];
|
|
1707
|
-
};
|
|
1708
|
-
command: null;
|
|
1709
|
-
}
|
|
1710
|
-
type EvaluationContext = CommandFlagContext | EventFlagContext;
|
|
1711
|
-
type CustomEvaluationFunction<E> = () => MaybePromise<E>;
|
|
1712
|
-
type CustomEvaluationContext<E> = {
|
|
1713
|
-
identify: E | CustomEvaluationFunction<E>;
|
|
1714
|
-
};
|
|
1715
|
-
interface FlagRunner<E, R> {
|
|
1716
|
-
(): Promise<R>;
|
|
1717
|
-
run(context: CustomEvaluationContext<E>): Promise<R>;
|
|
1718
|
-
}
|
|
1719
|
-
declare class FeatureFlag<R, T> {
|
|
1720
|
-
readonly options: FeatureFlagDefinition<R, T>;
|
|
1721
|
-
constructor(options: FeatureFlagDefinition<R, T>);
|
|
1722
|
-
private getContext;
|
|
1723
|
-
execute(res?: T): Promise<R>;
|
|
1724
|
-
}
|
|
1725
|
-
declare function flag<Returns = boolean, Entity = Record<any, any>>(options: FeatureFlagDefinition<Returns, Entity>): FlagRunner<Entity, Returns>;
|
|
1726
|
-
|
|
1727
|
-
declare class FlagStore extends Collection<string, FeatureFlag<any, any>> {
|
|
1728
|
-
}
|
|
1729
|
-
|
|
1730
|
-
interface CommandKitConfiguration {
|
|
1731
|
-
defaultLocale: Locale;
|
|
1732
|
-
getMessageCommandPrefix: (message: Message$1) => Awaitable<string | string[]>;
|
|
1733
|
-
}
|
|
1734
|
-
declare let commandkit: CommandKit;
|
|
1735
|
-
type BootstrapFunction = GenericFunction<[CommandKit]> | AsyncFunction<[CommandKit]>;
|
|
1736
|
-
/**
|
|
1737
|
-
* Registers a bootstrap hook that will be called when the CommandKit instance is created.
|
|
1738
|
-
* This is useful for plugins that need to run some code after the CommandKit instance is fully initialized.
|
|
1739
|
-
* Note that not all commandkit dependiencs are available at this point. It is recommended to use the `onApplicationBootstrap` hook instead,
|
|
1740
|
-
* if you need access to the commandkit dependencies.
|
|
1741
|
-
* @param fn The bootstrap function to register.
|
|
1742
|
-
* @example ```ts
|
|
1743
|
-
* import { onBootstrap } from 'commandkit';
|
|
1744
|
-
*
|
|
1745
|
-
* onBootstrap(async (commandkit) => {
|
|
1746
|
-
* // Do something with the commandkit instance
|
|
1747
|
-
* })
|
|
1748
|
-
* ```
|
|
1749
|
-
*/
|
|
1750
|
-
declare function onBootstrap<F extends BootstrapFunction>(fn: F): void;
|
|
1751
|
-
/**
|
|
1752
|
-
* Registers a bootstrap hook that will be called when the CommandKit instance is created.
|
|
1753
|
-
* This is useful for plugins that need to run some code after the CommandKit instance is fully initialized.
|
|
1754
|
-
* @param fn The bootstrap function to register.
|
|
1755
|
-
* @example ```ts
|
|
1756
|
-
* import { onApplicationBootstrap } from 'commandkit';
|
|
1757
|
-
*
|
|
1758
|
-
* onApplicationBootstrap(async (commandkit) => {
|
|
1759
|
-
* // Do something with the commandkit instance
|
|
1760
|
-
* })
|
|
1761
|
-
* ```
|
|
1762
|
-
*/
|
|
1763
|
-
declare function onApplicationBootstrap<F extends BootstrapFunction>(fn: F): void;
|
|
1764
|
-
declare class CommandKit extends EventEmitter {
|
|
1765
|
-
#private;
|
|
1766
|
-
private readonly options;
|
|
1767
|
-
eventInterceptor: EventInterceptor;
|
|
1768
|
-
static readonly createElement: typeof createElement;
|
|
1769
|
-
static readonly Fragment: typeof Fragment;
|
|
1770
|
-
readonly config: CommandKitConfiguration;
|
|
1771
|
-
readonly store: Map<string, any>;
|
|
1772
|
-
readonly flags: FlagStore;
|
|
1773
|
-
commandsRouter: CommandsRouter;
|
|
1774
|
-
eventsRouter: EventsRouter;
|
|
1775
|
-
readonly commandHandler: AppCommandHandler;
|
|
1776
|
-
readonly eventHandler: AppEventsHandler;
|
|
1777
|
-
readonly plugins: CommandKitPluginRuntime;
|
|
1778
|
-
readonly events: CommandKitEventsChannel;
|
|
1779
|
-
static instance: CommandKit | undefined;
|
|
1780
|
-
/**
|
|
1781
|
-
* Create a new command and event handler with CommandKit.
|
|
1782
|
-
*
|
|
1783
|
-
* @param options - The default CommandKit configuration.
|
|
1784
|
-
* @see {@link https://commandkit.js.org/docs/guide/commandkit-setup}
|
|
1785
|
-
*/
|
|
1786
|
-
constructor(options: CommandKitOptions);
|
|
1787
|
-
/**
|
|
1788
|
-
* Starts the commandkit application.
|
|
1789
|
-
* @param token The application token to connect to the discord gateway. If not provided, it will use the `TOKEN` or `DISCORD_TOKEN` environment variable. If set to `false`, it will not login.
|
|
1790
|
-
*/
|
|
1791
|
-
start(token?: string | false): Promise<void>;
|
|
1792
|
-
/**
|
|
1793
|
-
* Loads all the plugins.
|
|
1794
|
-
*/
|
|
1795
|
-
loadPlugins(): Promise<void>;
|
|
1796
|
-
/**
|
|
1797
|
-
* Whether or not the commandkit application has started.
|
|
1798
|
-
*/
|
|
1799
|
-
get started(): boolean;
|
|
1800
|
-
/**
|
|
1801
|
-
* Sets the prefix resolver for the command handler.
|
|
1802
|
-
* @param resolver The resolver function.
|
|
1803
|
-
*/
|
|
1804
|
-
setPrefixResolver(resolver: (message: Message$1) => Awaitable<string | string[]>): this;
|
|
1805
|
-
/**
|
|
1806
|
-
* Sets the default locale for the command handler.
|
|
1807
|
-
* @param locale The default locale.
|
|
1808
|
-
*/
|
|
1809
|
-
setDefaultLocale(locale: Locale): this;
|
|
1810
|
-
/**
|
|
1811
|
-
* Get the client attached to this CommandKit instance.
|
|
1812
|
-
*/
|
|
1813
|
-
get client(): discord_js.Client<boolean>;
|
|
1814
|
-
/**
|
|
1815
|
-
* Updates application commands with the latest from "commandsPath".
|
|
1816
|
-
*/
|
|
1817
|
-
reloadCommands(): Promise<void>;
|
|
1818
|
-
/**
|
|
1819
|
-
* Updates application events with the latest from "eventsPath".
|
|
1820
|
-
*/
|
|
1821
|
-
reloadEvents(): Promise<void>;
|
|
1822
|
-
/**
|
|
1823
|
-
* Increment the client listeners count.
|
|
1824
|
-
*/
|
|
1825
|
-
incrementClientListenersCount(): void;
|
|
1826
|
-
/**
|
|
1827
|
-
* Decrement the client listeners count.
|
|
1828
|
-
*/
|
|
1829
|
-
decrementClientListenersCount(): void;
|
|
1830
|
-
/**
|
|
1831
|
-
* Path to the app directory. Returns `null` if not found.
|
|
1832
|
-
* The lookup order is:
|
|
1833
|
-
* - `./app`
|
|
1834
|
-
* - `./src/app`
|
|
1835
|
-
*/
|
|
1836
|
-
getAppDirectory(): string | null;
|
|
1837
|
-
getPath(to: 'commands' | 'events'): string | null;
|
|
1838
|
-
}
|
|
1839
|
-
|
|
1840
|
-
interface CommandKitConfig {
|
|
1841
|
-
/**
|
|
1842
|
-
* The plugins to use with CommandKit.
|
|
1843
|
-
* Can be a single plugin, an array of plugins, or a nested array of plugins.
|
|
1844
|
-
*/
|
|
1845
|
-
plugins?: MaybeArray<CommandKitPlugin>[] | Array<CommandKitPlugin>;
|
|
1846
|
-
/**
|
|
1847
|
-
* The esbuild plugins to use with CommandKit.
|
|
1848
|
-
*/
|
|
1849
|
-
esbuildPlugins?: any[];
|
|
1850
|
-
/**
|
|
1851
|
-
* The compiler options to use with CommandKit.
|
|
1852
|
-
*/
|
|
1853
|
-
compilerOptions?: {
|
|
1854
|
-
/**
|
|
1855
|
-
* Macro compiler configuration.
|
|
1856
|
-
*/
|
|
1857
|
-
macro?: {
|
|
1858
|
-
/**
|
|
1859
|
-
* Whether to enable macro function compilation in development mode.
|
|
1860
|
-
* @default false
|
|
1861
|
-
*/
|
|
1862
|
-
development?: boolean;
|
|
1863
|
-
};
|
|
1864
|
-
};
|
|
1865
|
-
/**
|
|
1866
|
-
* The typescript configuration to use with CommandKit.
|
|
1867
|
-
*/
|
|
1868
|
-
typescript?: {
|
|
1869
|
-
/**
|
|
1870
|
-
* Whether to ignore type checking during builds.
|
|
1871
|
-
*/
|
|
1872
|
-
ignoreBuildErrors?: boolean;
|
|
1873
|
-
};
|
|
1874
|
-
/**
|
|
1875
|
-
* Whether to generate static command handler data in production builds.
|
|
1876
|
-
*/
|
|
1877
|
-
static?: boolean;
|
|
1878
|
-
/**
|
|
1879
|
-
* Statically define the environment variables to use.
|
|
1880
|
-
*/
|
|
1881
|
-
env?: Record<string, string>;
|
|
1882
|
-
/**
|
|
1883
|
-
* The custom build directory name to use.
|
|
1884
|
-
* @default `dist`
|
|
1885
|
-
*/
|
|
1886
|
-
distDir?: string;
|
|
1887
|
-
/**
|
|
1888
|
-
* Whether or not to enable the source map generation.
|
|
1889
|
-
*/
|
|
1890
|
-
sourceMap?: {
|
|
1891
|
-
/**
|
|
1892
|
-
* Whether to enable source map generation in development mode.
|
|
1893
|
-
*/
|
|
1894
|
-
development?: boolean;
|
|
1895
|
-
/**
|
|
1896
|
-
* Whether to enable source map generation in production mode.
|
|
1897
|
-
*/
|
|
1898
|
-
production?: boolean;
|
|
1899
|
-
};
|
|
1900
|
-
/**
|
|
1901
|
-
* Whether or not to enable the typed commands.
|
|
1902
|
-
* @default true
|
|
1903
|
-
*/
|
|
1904
|
-
typedCommands?: boolean;
|
|
1905
|
-
}
|
|
1906
|
-
|
|
1907
|
-
type DeepRequired<T> = {
|
|
1908
|
-
[P in keyof T]-?: DeepRequired<T[P]>;
|
|
1909
|
-
};
|
|
1910
|
-
type ResolvedCommandKitConfig = DeepRequired<CommandKitConfig>;
|
|
1911
|
-
|
|
1912
|
-
/**
|
|
1913
|
-
* Get the defined configuration for CommandKit.
|
|
1914
|
-
*/
|
|
1915
|
-
declare function getConfig(): ResolvedCommandKitConfig;
|
|
1916
|
-
/**
|
|
1917
|
-
* Define the configuration for CommandKit.
|
|
1918
|
-
* @param config The configuration to use.
|
|
1919
|
-
*/
|
|
1920
|
-
declare function defineConfig(config?: Partial<CommandKitConfig>): ResolvedCommandKitConfig;
|
|
1921
|
-
|
|
1922
|
-
interface ILogger {
|
|
1923
|
-
log(...args: any[]): void;
|
|
1924
|
-
error(...args: any[]): void;
|
|
1925
|
-
warn(...args: any[]): void;
|
|
1926
|
-
info(...args: any[]): void;
|
|
1927
|
-
debug(...args: any[]): void;
|
|
1928
|
-
}
|
|
1929
|
-
|
|
1930
|
-
declare class DefaultLogger implements ILogger {
|
|
1931
|
-
stdout: NodeJS.WriteStream & {
|
|
1932
|
-
fd: 1;
|
|
1933
|
-
};
|
|
1934
|
-
stderr: NodeJS.WriteStream & {
|
|
1935
|
-
fd: 2;
|
|
1936
|
-
};
|
|
1937
|
-
private logger;
|
|
1938
|
-
constructor(stdout?: NodeJS.WriteStream & {
|
|
1939
|
-
fd: 1;
|
|
1940
|
-
}, stderr?: NodeJS.WriteStream & {
|
|
1941
|
-
fd: 2;
|
|
1942
|
-
});
|
|
1943
|
-
private _formatTime;
|
|
1944
|
-
private _getContext;
|
|
1945
|
-
private _getLevelLabel;
|
|
1946
|
-
private _getPrefix;
|
|
1947
|
-
private _log;
|
|
1948
|
-
debug(...args: any[]): void;
|
|
1949
|
-
error(...args: any[]): void;
|
|
1950
|
-
log(...args: any[]): void;
|
|
1951
|
-
info(...args: any[]): void;
|
|
1952
|
-
warn(...args: any[]): void;
|
|
1953
|
-
}
|
|
1954
|
-
|
|
1955
|
-
interface CommandKitLoggerOptions {
|
|
1956
|
-
/**
|
|
1957
|
-
* The logger provider to use.
|
|
1958
|
-
*/
|
|
1959
|
-
provider: ILogger;
|
|
1960
|
-
}
|
|
1961
|
-
interface LoggerImpl extends ILogger {
|
|
1962
|
-
configure(options: CommandKitLoggerOptions): void;
|
|
1963
|
-
}
|
|
1964
|
-
declare function createLogger(options: CommandKitLoggerOptions): LoggerImpl;
|
|
1965
|
-
declare const Logger: LoggerImpl;
|
|
1966
|
-
|
|
1967
|
-
/**
|
|
1968
|
-
* The current version of CommandKit.
|
|
1969
|
-
*/
|
|
1970
|
-
declare const version: string;
|
|
1971
|
-
|
|
1972
|
-
declare function getCurrentDirectory(): string;
|
|
1973
|
-
declare function getSourceDirectories(): string[];
|
|
1974
|
-
/**
|
|
1975
|
-
* Debounces a function.
|
|
1976
|
-
* @param fn The function to debounce.
|
|
1977
|
-
* @param ms The debounce time in milliseconds.
|
|
1978
|
-
* @returns The debounced function.
|
|
1979
|
-
*/
|
|
1980
|
-
declare function debounce<R, F extends (...args: any[]) => R>(fn: F, ms: number): F;
|
|
1981
|
-
/**
|
|
1982
|
-
* Creates a function from the given function that runs only in development mode.
|
|
1983
|
-
* @param fn The function to run in development mode.
|
|
1984
|
-
* @returns The function that runs only in development mode.
|
|
1985
|
-
* @example
|
|
1986
|
-
* ```ts
|
|
1987
|
-
* const devOnlyFn = devOnly(() => {
|
|
1988
|
-
* console.log('This function runs only in development mode');
|
|
1989
|
-
* });
|
|
1990
|
-
* devOnlyFn(); // This will log the message only in development mode
|
|
1991
|
-
* ```
|
|
1992
|
-
*/
|
|
1993
|
-
declare function devOnly<T extends (...args: any[]) => any>(fn: T): T;
|
|
1994
|
-
/**
|
|
1995
|
-
* Custom error for stopping event propagation.
|
|
1996
|
-
*/
|
|
1997
|
-
declare class StopEventPropagationError extends Error {
|
|
1998
|
-
constructor();
|
|
1999
|
-
}
|
|
2000
|
-
/**
|
|
2001
|
-
* Stops event propagation.
|
|
2002
|
-
* @throws {StopEventPropagationError}
|
|
2003
|
-
*/
|
|
2004
|
-
declare function stopEvents(): never;
|
|
2005
|
-
|
|
2006
|
-
interface EventWorkerContext {
|
|
2007
|
-
event: string;
|
|
2008
|
-
namespace: string | null;
|
|
2009
|
-
data: ParsedEvent;
|
|
2010
|
-
commandkit: CommandKit;
|
|
2011
|
-
arguments: any[];
|
|
2012
|
-
}
|
|
2013
|
-
declare const eventWorkerContext: AsyncLocalStorage<EventWorkerContext>;
|
|
2014
|
-
declare function runInEventWorkerContext<T>(context: EventWorkerContext, callback: () => T): T;
|
|
2015
|
-
declare function getEventWorkerContext(): EventWorkerContext;
|
|
2016
|
-
|
|
2017
|
-
/**
|
|
2018
|
-
* Creates a command line interface for CommandKit.
|
|
2019
|
-
* @param argv The arguments passed to the CLI.
|
|
2020
|
-
* @param options The options passed to the CLI.
|
|
2021
|
-
*/
|
|
2022
|
-
declare function bootstrapCommandkitCLI(argv: string[], options?: commander.ParseOptions | undefined): Promise<void>;
|
|
2023
|
-
|
|
2024
|
-
export { ActionRow, type ActionRowProps, type AnyCommandExecute, type AnyCommandKitElement, AppCommandHandler, type AsyncFunction, type AutocompleteCommand, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, type BootstrapFunction, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, COMMANDKIT_BOOTSTRAP_MODE, COMMANDKIT_CACHE_TAG, COMMANDKIT_IS_DEV, COMMANDKIT_IS_TEST, ChannelSelectMenu, ChannelSelectMenuKit, type ChannelSelectMenuKitPredicate, type ChannelSelectMenuProps, type ChatInputCommand, type ChatInputCommandContext, type Command, type CommandBuilderLike, type CommandContext, type CommandContextOptions, type CommandData, CommandExecutionMode, type CommandFlagContext, CommandKit, type CommandKitButtonBuilderInteractionCollectorDispatch, type CommandKitButtonBuilderInteractionCollectorDispatchContextData, type CommandKitButtonBuilderOnEnd, type CommandKitConfiguration, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitEventDispatch, 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, CommonDirectiveTransformer, type CommonDirectiveTransformerOptions, type CommonPluginRuntime, type CommonSelectMenuProps, CompilerPlugin, CompilerPluginRuntime, Container, type ContainerProps, Context, type ContextParameters, type CustomEvaluationContext, type CustomEvaluationFunction, type DecideFunction, DefaultLogger, ElementType, type EvaluationContext, type EventFlagContext, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, type EventWorkerContext, EventsRouter, type EventsRouterOptions, type EventsTree, FeatureFlag, type FeatureFlagDefinition, File, type FileProps, type FlagRunner, Fragment, type FragmentElementProps, type GenericFunction, HMREventType, type ILogger, type IdentifyFunction, type InteractionCommandContext, type InteractionCommandMiddlewareContext, type LoadedCommand, type Loader, type Location, Logger, type LoggerImpl, type MaybeArray, type MaybeFalsey, type MaybePromise, MediaGallery, MediaGalleryItem, type MediaGalleryItemProps, type MediaGalleryProps, 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, Section, type SectionProps, type SelectMenuKitPredicate, type SelectMenuProps, Separator, type SeparatorProps, type Setup, ShortInput, type SlashCommandMiddlewareContext, StopEventPropagationError, type StringEncodable, StringSelectMenu, StringSelectMenuKit, type StringSelectMenuKitPredicate, StringSelectMenuOption, type StringSelectMenuOptionProps, type StringSelectMenuProps, TextDisplay, type TextDisplayProps, TextInput, type TextInputProps, Thumbnail, type ThumbnailProps, type TransformedResult, type UserContextMenuCommand, type UserContextMenuCommandContext, type UserContextMenuCommandMiddlewareContext, UserSelectMenu, UserSelectMenuKit, type UserSelectMenuKitPredicate, type UserSelectMenuProps, after, bootstrapCommandkitCLI, cancelAfter, commandkit, createElement, createLogger, debounce, CommandKit as default, defineConfig, devOnly, eventWorkerContext, exitContext, exitMiddleware, flag, fromEsbuildPlugin, getCommandKit, getConfig, getContext, getCurrentDirectory, getElement, getEventWorkerContext, getSourceDirectories, isCommandKitElement, isCompilerPlugin, isInteractionSource, isMessageSource, isRuntimePlugin, createElement as jsx, createElement as jsxs, makeContextAwareFunction, onApplicationBootstrap, onBootstrap, provideContext, redirect, rethrow, runInEventWorkerContext, stopEvents, useEnvironment, version };
|
|
1
|
+
import { y as CommandKit } from './CommandKit-jZCy9fZX.js';
|
|
2
|
+
export { n as AnyCommandExecute, A as AppCommandHandler, K as AsyncFunction, p as AutocompleteCommand, h as AutocompleteCommandContext, i as AutocompleteCommandMiddlewareContext, E as BootstrapFunction, o as ChatInputCommand, g as ChatInputCommandContext, b as CommandBuilderLike, a1 as CommandContext, m as CommandContextOptions, a2 as CommandData, c as CommandExecutionMode, al as CommandFlagContext, B as CommandKitConfiguration, Y as CommandKitEnvironment, X as CommandKitEnvironmentInternalData, Z as CommandKitEnvironmentType, ac as CommandKitEventDispatch, z as CommandKitHMREvent, a0 as CommandKitOptions, aa as CommandKitPlugin, ad as CommandKitPluginRuntime, x as CommandRegistrar, C as CommandTypeData, ag as CommonPluginRuntime, a6 as CompilerPlugin, ae as CompilerPluginRuntime, u as Context, d as ContextParameters, ap as CustomEvaluationContext, ao as CustomEvaluationFunction, aj as DecideFunction, an as EvaluationContext, am as EventFlagContext, ar as FeatureFlag, ak as FeatureFlagDefinition, aq as FlagRunner, H as GenericFunction, ai as IdentifyFunction, I as InteractionCommandContext, f as InteractionCommandMiddlewareContext, L as LoadedCommand, ab as MaybeFalsey, ah as MaybePromise, s as MessageCommand, M as MessageCommandContext, e as MessageCommandMiddlewareContext, q as MessageContextMenuCommand, j as MessageContextMenuCommandContext, k as MessageContextMenuCommandMiddlewareContext, v as MiddlewareContext, t as MiddlewareContextArgs, a3 as PluginTransformParameters, w as PreRegisterCommandsEvent, P as PreparedAppCommandExecution, a as ResolvableCommand, a5 as ResolveResult, R as RunCommand, a8 as RuntimePlugin, S as SlashCommandMiddlewareContext, a4 as TransformedResult, r as UserContextMenuCommand, U as UserContextMenuCommandContext, l as UserContextMenuCommandMiddlewareContext, _ as after, $ as cancelAfter, D as commandkit, N as exitContext, as as flag, af as fromEsbuildPlugin, T as getCommandKit, V as getContext, J as isCommandWorkerContext, a7 as isCompilerPlugin, a9 as isRuntimePlugin, Q as makeContextAwareFunction, G as onApplicationBootstrap, F as onBootstrap, O as provideContext, W as useEnvironment } from './CommandKit-jZCy9fZX.js';
|
|
3
|
+
export { ActionRow, ActionRowProps } from './components/v1/action-row/ActionRow.js';
|
|
4
|
+
export { ButtonKit, ButtonKitPredicate, CommandKitButtonBuilderInteractionCollectorDispatch, CommandKitButtonBuilderInteractionCollectorDispatchContextData, CommandKitButtonBuilderOnEnd, OnButtonKitClick, OnButtonKitEnd } from './components/v1/button/ButtonKit.js';
|
|
5
|
+
export { Button, ButtonChildrenLike, ButtonProps } from './components/v1/button/Button.js';
|
|
6
|
+
export { CommandKitModalBuilderInteractionCollectorDispatch, CommandKitModalBuilderInteractionCollectorDispatchContextData, CommandKitModalBuilderOnEnd, ModalKit, ModalKitPredicate, OnModalKitEnd, OnModalKitSubmit } from './components/v1/modal/ModalKit.js';
|
|
7
|
+
export { Modal, ModalProps, ParagraphInput, ShortInput, TextInput, TextInputProps } from './components/v1/modal/Modal.js';
|
|
8
|
+
export { OnStringSelectMenuKitSubmit, StringSelectMenuKit, StringSelectMenuKitPredicate } from './components/v1/select-menu/StringSelectMenuKit.js';
|
|
9
|
+
export { ChannelSelectMenuKit, ChannelSelectMenuKitPredicate, OnChannelSelectMenuKitSubmit } from './components/v1/select-menu/ChannelSelectMenuKit.js';
|
|
10
|
+
export { MentionableSelectMenuKit, MentionableSelectMenuKitPredicate, OnMentionableSelectMenuKitSubmit } from './components/v1/select-menu/MentionableSelectMenuKit.js';
|
|
11
|
+
export { OnUserSelectMenuKitSubmit, UserSelectMenuKit, UserSelectMenuKitPredicate } from './components/v1/select-menu/UserSelectMenuKit.js';
|
|
12
|
+
export { OnRoleSelectMenuKitSubmit, RoleSelectMenuKit, RoleSelectMenuKitPredicate } from './components/v1/select-menu/RoleSelectMenuKit.js';
|
|
13
|
+
export { ChannelSelectMenu, ChannelSelectMenuProps, CommonBuilderKit, CommonSelectMenuProps, MentionableSelectMenu, MentionableSelectMenuProps, ResolveBuilderInteraction, RoleSelectMenu, RoleSelectMenuProps, SelectMenuProps, StringSelectMenu, StringSelectMenuOption, StringSelectMenuOptionProps, StringSelectMenuProps, UserSelectMenu, UserSelectMenuProps } from './components/v1/select-menu/SelectMenu.js';
|
|
14
|
+
export { CommandKitSelectMenuBuilderInteractionCollectorDispatch, CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData, CommandKitSelectMenuBuilderOnEnd, OnSelectMenuKitEnd, OnSelectMenuKitSubmit, SelectMenuKitPredicate } from './components/v1/select-menu/common.js';
|
|
15
|
+
export { Container, ContainerProps } from './components/v2/container.js';
|
|
16
|
+
export { File, FileProps } from './components/v2/file.js';
|
|
17
|
+
export { MediaGallery, MediaGalleryItem, MediaGalleryItemProps, MediaGalleryProps } from './components/v2/media-gallery.js';
|
|
18
|
+
export { Section, SectionProps, Thumbnail, ThumbnailProps } from './components/v2/section.js';
|
|
19
|
+
export { Separator, SeparatorProps } from './components/v2/separator.js';
|
|
20
|
+
export { StringEncodable, TextDisplay, TextDisplayProps } from './components/v2/text-display.js';
|
|
21
|
+
export { AnyCommandKitElement, CommandKitElement, CommandKitElementData, ElementType, Fragment, FragmentElementProps, jsx as createElement, getElement, isCommandKitElement, jsx, jsx as jsxs } from './components/common/element.js';
|
|
22
|
+
export { MaybeArray } from './components/common/types.js';
|
|
23
|
+
export { EventInterceptor, EventInterceptorContextData, EventInterceptorErrorHandler } from './components/common/EventInterceptor.js';
|
|
24
|
+
export { defineConfig, getConfig } from './config/config.js';
|
|
25
|
+
export { MessageCommandOptions, MessageCommandOptionsSchema, MessageCommandParser, ParsedMessageCommand } from './app/commands/MessageCommandParser.js';
|
|
26
|
+
export { exitMiddleware, redirect, rethrow } from './app/middleware/signals.js';
|
|
27
|
+
export { CommandSource, isInteractionSource, isMessageSource } from './app/commands/helpers.js';
|
|
28
|
+
export { DefaultLogger } from './logger/DefaultLogger.js';
|
|
29
|
+
export { ILogger } from './logger/ILogger.js';
|
|
30
|
+
export { CommandKitLoggerOptions, Logger, LoggerImpl, createLogger } from './logger/Logger.js';
|
|
31
|
+
export { Command, CommandsRouter, CommandsRouterOptions, Middleware, ParsedCommandData } from './app/router/CommandsRouter.js';
|
|
32
|
+
export { EventsRouter, EventsRouterOptions, EventsTree, ParsedEvent } from './app/router/EventsRouter.js';
|
|
33
|
+
export { version } from './version.js';
|
|
34
|
+
export { Loader, Location, Message, OnLoadArgs, OnLoadOptions, OnLoadResult, OnResolveArgs, OnResolveOptions, OnResolveResult, ResolveKind, Setup } from './plugins/plugin-runtime/types.js';
|
|
35
|
+
export { CommonDirectiveTransformer, CommonDirectiveTransformerOptions } from './plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js';
|
|
36
|
+
export { StopEventPropagationError, debounce, devOnly, getCurrentDirectory, getSourceDirectories, stopEvents } from './utils/utilities.js';
|
|
37
|
+
export { COMMANDKIT_BOOTSTRAP_MODE, COMMANDKIT_CACHE_TAG, COMMANDKIT_IS_DEV, COMMANDKIT_IS_TEST, HMREventType } from './utils/constants.js';
|
|
38
|
+
export { EventWorkerContext, eventWorkerContext, getEventWorkerContext, isEventWorkerContext, runInEventWorkerContext } from './app/events/EventWorkerContext.js';
|
|
39
|
+
export { bootstrapCommandkitCLI } from './cli/init.js';
|
|
40
|
+
import 'discord.js';
|
|
41
|
+
import 'node:events';
|
|
42
|
+
import './config/types.js';
|
|
43
|
+
import './config/utils.js';
|
|
44
|
+
import 'diagnostics_channel';
|
|
45
|
+
import 'directive-to-hof';
|
|
46
|
+
import 'node:async_hooks';
|
|
47
|
+
import 'commander';
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
export { CommandKit, CommandKit as default };
|