commandkit 0.1.11-dev.20240203230231 → 0.1.11-dev.20241214160006
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/bin/build.mjs +126 -0
- package/bin/common.mjs +125 -0
- package/bin/development.mjs +180 -0
- package/bin/index.mjs +53 -0
- package/bin/parse-env.mjs +65 -0
- package/bin/production.mjs +86 -0
- package/dist/{CommandKit-GIHMEeqf.d.ts → CommandKit-Co5QNlps.d.ts} +143 -144
- package/dist/{CommandKit--SA9LcIq.d.mts → CommandKit-D84HlsL0.d.mts} +143 -144
- package/dist/CommandKit.d.mts +1 -1
- package/dist/CommandKit.d.ts +1 -1
- package/dist/CommandKit.js +1 -1
- package/dist/CommandKit.js.map +1 -1
- package/dist/CommandKit.mjs +1 -1
- package/dist/{chunk-BXBLPEWT.mjs → chunk-6B4TPFI4.mjs} +2 -2
- package/dist/chunk-6B4TPFI4.mjs.map +1 -0
- package/dist/{chunk-R6PIHRXD.mjs → chunk-6J4XVVL4.mjs} +2 -2
- package/dist/{chunk-7KD7ZCH6.mjs → chunk-6TIBWNPX.mjs} +1 -1
- package/dist/{chunk-KUU3KDAE.mjs → chunk-7YWJADOI.mjs} +2 -2
- package/dist/{chunk-TZXZ3UZS.mjs → chunk-CATZUF3K.mjs} +2 -2
- package/dist/{chunk-KATLDJ7Z.mjs → chunk-EQ62HPWY.mjs} +2 -2
- package/dist/{chunk-Q7UFCVZL.mjs → chunk-FBYSGXIA.mjs} +2 -2
- package/dist/chunk-FBYSGXIA.mjs.map +1 -0
- package/dist/{chunk-6CLMSPNA.mjs → chunk-IHDVSF4H.mjs} +2 -2
- package/dist/{chunk-6CLMSPNA.mjs.map → chunk-IHDVSF4H.mjs.map} +1 -1
- package/dist/{chunk-RQQKHSL6.mjs → chunk-JWT7PUZJ.mjs} +2 -2
- package/dist/chunk-JWT7PUZJ.mjs.map +1 -0
- package/dist/{chunk-SYOEMO4R.mjs → chunk-KR3OAQKX.mjs} +2 -2
- package/dist/chunk-MTG5LNGD.mjs +2 -0
- package/dist/chunk-MTG5LNGD.mjs.map +1 -0
- package/dist/{chunk-77LPS2WP.mjs → chunk-PXNT5WYC.mjs} +2 -2
- package/dist/{chunk-CHI4NRSH.mjs → chunk-Q7JC46G6.mjs} +2 -2
- package/dist/chunk-Q7JC46G6.mjs.map +1 -0
- package/dist/chunk-VHU3SDTR.mjs +2 -0
- package/dist/{chunk-FQGSVSCT.mjs.map → chunk-VHU3SDTR.mjs.map} +1 -1
- package/dist/chunk-XVIYQWRZ.mjs +2 -0
- package/dist/{chunk-SXUJOOQY.mjs → chunk-Y7QBWZVQ.mjs} +2 -2
- package/dist/components/ButtonKit.js +1 -1
- package/dist/components/ButtonKit.js.map +1 -1
- package/dist/components/ButtonKit.mjs +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/config.d.mts +5 -7
- package/dist/config.d.ts +5 -7
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/config.mjs +1 -1
- package/dist/handlers/command-handler/CommandHandler.d.mts +1 -1
- package/dist/handlers/command-handler/CommandHandler.d.ts +1 -1
- package/dist/handlers/command-handler/CommandHandler.js +1 -1
- package/dist/handlers/command-handler/CommandHandler.js.map +1 -1
- package/dist/handlers/command-handler/CommandHandler.mjs +1 -1
- package/dist/handlers/command-handler/functions/loadCommandsWithRest.d.mts +1 -1
- package/dist/handlers/command-handler/functions/loadCommandsWithRest.d.ts +1 -1
- package/dist/handlers/command-handler/functions/loadCommandsWithRest.js +1 -1
- package/dist/handlers/command-handler/functions/loadCommandsWithRest.js.map +1 -1
- package/dist/handlers/command-handler/functions/loadCommandsWithRest.mjs +1 -1
- package/dist/handlers/command-handler/functions/registerCommands.d.mts +1 -1
- package/dist/handlers/command-handler/functions/registerCommands.d.ts +1 -1
- package/dist/handlers/command-handler/functions/registerCommands.js +1 -1
- package/dist/handlers/command-handler/functions/registerCommands.js.map +1 -1
- package/dist/handlers/command-handler/functions/registerCommands.mjs +1 -1
- package/dist/handlers/command-handler/typings.d.mts +1 -1
- package/dist/handlers/command-handler/typings.d.ts +1 -1
- package/dist/handlers/command-handler/typings.js.map +1 -1
- package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.mjs +1 -1
- package/dist/handlers/command-handler/validations/devOnly.d.mts +1 -1
- package/dist/handlers/command-handler/validations/devOnly.d.ts +1 -1
- package/dist/handlers/command-handler/validations/devOnly.mjs +1 -1
- package/dist/handlers/command-handler/validations/index.d.mts +1 -1
- package/dist/handlers/command-handler/validations/index.d.ts +1 -1
- package/dist/handlers/command-handler/validations/index.mjs +1 -1
- package/dist/handlers/command-handler/validations/permissions.d.mts +1 -1
- package/dist/handlers/command-handler/validations/permissions.d.ts +1 -1
- package/dist/handlers/command-handler/validations/permissions.mjs +1 -1
- package/dist/handlers/event-handler/EventHandler.d.mts +1 -1
- package/dist/handlers/event-handler/EventHandler.d.ts +1 -1
- package/dist/handlers/event-handler/EventHandler.js +1 -1
- package/dist/handlers/event-handler/EventHandler.js.map +1 -1
- package/dist/handlers/event-handler/EventHandler.mjs +1 -1
- package/dist/handlers/event-handler/typings.d.mts +1 -1
- package/dist/handlers/event-handler/typings.d.ts +1 -1
- package/dist/handlers/index.d.mts +1 -1
- package/dist/handlers/index.d.ts +1 -1
- package/dist/handlers/index.js +1 -1
- package/dist/handlers/index.js.map +1 -1
- package/dist/handlers/index.mjs +1 -1
- package/dist/handlers/validation-handler/ValidationHandler.js +1 -1
- package/dist/handlers/validation-handler/ValidationHandler.js.map +1 -1
- package/dist/handlers/validation-handler/ValidationHandler.mjs +1 -1
- package/dist/index.d.mts +1 -12
- package/dist/index.d.ts +1 -12
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.mts +5 -0
- package/dist/types.d.ts +5 -0
- package/dist/{types/index.js → types.js} +1 -1
- package/dist/types.js.map +1 -0
- package/dist/types.mjs +2 -0
- package/dist/types.mjs.map +1 -0
- package/dist/utils/clone.mjs +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/colors.js.map +1 -1
- package/dist/utils/colors.mjs +1 -1
- package/dist/utils/get-paths.mjs +1 -1
- package/dist/utils/resolve-file-url.mjs +1 -1
- package/package.json +7 -8
- package/bin/index.cjs +0 -3
- package/dist/bootstrap/client.d.mts +0 -13
- package/dist/bootstrap/client.d.ts +0 -13
- package/dist/bootstrap/client.js +0 -2
- package/dist/bootstrap/client.js.map +0 -1
- package/dist/bootstrap/client.mjs +0 -2
- package/dist/bootstrap/loadEnv.d.mts +0 -3
- package/dist/bootstrap/loadEnv.d.ts +0 -3
- package/dist/bootstrap/loadEnv.js +0 -2
- package/dist/bootstrap/loadEnv.js.map +0 -1
- package/dist/bootstrap/loadEnv.mjs +0 -2
- package/dist/bootstrap/loadEnv.mjs.map +0 -1
- package/dist/chunk-5AIBE2QR.mjs +0 -2
- package/dist/chunk-7KD7ZCH6.mjs.map +0 -1
- package/dist/chunk-BCQP4DZP.mjs +0 -2
- package/dist/chunk-BCQP4DZP.mjs.map +0 -1
- package/dist/chunk-BJCWVCAY.mjs +0 -2
- package/dist/chunk-BJCWVCAY.mjs.map +0 -1
- package/dist/chunk-BXBLPEWT.mjs.map +0 -1
- package/dist/chunk-CHI4NRSH.mjs.map +0 -1
- package/dist/chunk-DEB7FLUS.mjs +0 -2
- package/dist/chunk-DEB7FLUS.mjs.map +0 -1
- package/dist/chunk-FQGSVSCT.mjs +0 -2
- package/dist/chunk-IFTUM7TS.mjs +0 -2
- package/dist/chunk-IFTUM7TS.mjs.map +0 -1
- package/dist/chunk-Q7UFCVZL.mjs.map +0 -1
- package/dist/chunk-QC2F7O3S.mjs +0 -2
- package/dist/chunk-QC2F7O3S.mjs.map +0 -1
- package/dist/chunk-QYJ4DE3N.mjs +0 -2
- package/dist/chunk-QYJ4DE3N.mjs.map +0 -1
- package/dist/chunk-RQQKHSL6.mjs.map +0 -1
- package/dist/chunk-SB3FAFCD.mjs +0 -2
- package/dist/chunk-SB3FAFCD.mjs.map +0 -1
- package/dist/chunk-UV2LVAQV.mjs +0 -2
- package/dist/chunk-UV2LVAQV.mjs.map +0 -1
- package/dist/chunk-ZJRAI4W5.mjs +0 -2
- package/dist/chunk-ZJRAI4W5.mjs.map +0 -1
- package/dist/environment/actions/development.d.mts +0 -8
- package/dist/environment/actions/development.d.ts +0 -8
- package/dist/environment/actions/development.js +0 -2
- package/dist/environment/actions/development.js.map +0 -1
- package/dist/environment/actions/development.mjs +0 -2
- package/dist/environment/actions/development.mjs.map +0 -1
- package/dist/environment/bundler/bundle.d.mts +0 -3
- package/dist/environment/bundler/bundle.d.ts +0 -3
- package/dist/environment/bundler/bundle.js +0 -2
- package/dist/environment/bundler/bundle.js.map +0 -1
- package/dist/environment/bundler/bundle.mjs +0 -2
- package/dist/environment/bundler/bundle.mjs.map +0 -1
- package/dist/environment/bundler/shims.d.mts +0 -3
- package/dist/environment/bundler/shims.d.ts +0 -3
- package/dist/environment/bundler/shims.js +0 -11
- package/dist/environment/bundler/shims.js.map +0 -1
- package/dist/environment/bundler/shims.mjs +0 -11
- package/dist/environment/bundler/shims.mjs.map +0 -1
- package/dist/environment/cli.d.mts +0 -2
- package/dist/environment/cli.d.ts +0 -2
- package/dist/environment/cli.js +0 -2
- package/dist/environment/cli.js.map +0 -1
- package/dist/environment/cli.mjs +0 -2
- package/dist/environment/cli.mjs.map +0 -1
- package/dist/environment/common/config.d.mts +0 -7
- package/dist/environment/common/config.d.ts +0 -7
- package/dist/environment/common/config.js +0 -2
- package/dist/environment/common/config.js.map +0 -1
- package/dist/environment/common/config.mjs +0 -2
- package/dist/environment/common/config.mjs.map +0 -1
- package/dist/environment/common/logger.d.mts +0 -9
- package/dist/environment/common/logger.d.ts +0 -9
- package/dist/environment/common/logger.js +0 -2
- package/dist/environment/common/logger.js.map +0 -1
- package/dist/environment/common/logger.mjs +0 -2
- package/dist/environment/common/logger.mjs.map +0 -1
- package/dist/hooks/common.d.mts +0 -12
- package/dist/hooks/common.d.ts +0 -12
- package/dist/hooks/common.js +0 -11
- package/dist/hooks/common.js.map +0 -1
- package/dist/hooks/common.mjs +0 -2
- package/dist/hooks/common.mjs.map +0 -1
- package/dist/hooks/index.d.mts +0 -14
- package/dist/hooks/index.d.ts +0 -14
- package/dist/hooks/index.js +0 -11
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/index.mjs +0 -2
- package/dist/hooks/index.mjs.map +0 -1
- package/dist/hooks/response.d.mts +0 -7
- package/dist/hooks/response.d.ts +0 -7
- package/dist/hooks/response.js +0 -11
- package/dist/hooks/response.js.map +0 -1
- package/dist/hooks/response.mjs +0 -2
- package/dist/hooks/response.mjs.map +0 -1
- package/dist/hooks/useChannel.d.mts +0 -5
- package/dist/hooks/useChannel.d.ts +0 -5
- package/dist/hooks/useChannel.js +0 -11
- package/dist/hooks/useChannel.js.map +0 -1
- package/dist/hooks/useChannel.mjs +0 -2
- package/dist/hooks/useChannel.mjs.map +0 -1
- package/dist/hooks/useClient.d.mts +0 -5
- package/dist/hooks/useClient.d.ts +0 -5
- package/dist/hooks/useClient.js +0 -11
- package/dist/hooks/useClient.js.map +0 -1
- package/dist/hooks/useClient.mjs +0 -2
- package/dist/hooks/useClient.mjs.map +0 -1
- package/dist/hooks/useCommandData.d.mts +0 -5
- package/dist/hooks/useCommandData.d.ts +0 -5
- package/dist/hooks/useCommandData.js +0 -11
- package/dist/hooks/useCommandData.js.map +0 -1
- package/dist/hooks/useCommandData.mjs +0 -2
- package/dist/hooks/useCommandData.mjs.map +0 -1
- package/dist/hooks/useCommandKit.d.mts +0 -9
- package/dist/hooks/useCommandKit.d.ts +0 -9
- package/dist/hooks/useCommandKit.js +0 -11
- package/dist/hooks/useCommandKit.js.map +0 -1
- package/dist/hooks/useCommandKit.mjs +0 -2
- package/dist/hooks/useCommandKit.mjs.map +0 -1
- package/dist/hooks/useGuild.d.mts +0 -5
- package/dist/hooks/useGuild.d.ts +0 -5
- package/dist/hooks/useGuild.js +0 -11
- package/dist/hooks/useGuild.js.map +0 -1
- package/dist/hooks/useGuild.mjs +0 -2
- package/dist/hooks/useGuild.mjs.map +0 -1
- package/dist/hooks/useInteraction.d.mts +0 -9
- package/dist/hooks/useInteraction.d.ts +0 -9
- package/dist/hooks/useInteraction.js +0 -11
- package/dist/hooks/useInteraction.js.map +0 -1
- package/dist/hooks/useInteraction.mjs +0 -2
- package/dist/hooks/useInteraction.mjs.map +0 -1
- package/dist/hooks/useMember.d.mts +0 -5
- package/dist/hooks/useMember.d.ts +0 -5
- package/dist/hooks/useMember.js +0 -11
- package/dist/hooks/useMember.js.map +0 -1
- package/dist/hooks/useMember.mjs +0 -2
- package/dist/hooks/useMember.mjs.map +0 -1
- package/dist/hooks/useUser.d.mts +0 -5
- package/dist/hooks/useUser.d.ts +0 -5
- package/dist/hooks/useUser.js +0 -11
- package/dist/hooks/useUser.js.map +0 -1
- package/dist/hooks/useUser.mjs +0 -2
- package/dist/hooks/useUser.mjs.map +0 -1
- package/dist/types/index.d.mts +0 -5
- package/dist/types/index.d.ts +0 -5
- package/dist/types/index.js.map +0 -1
- package/dist/types/index.mjs +0 -2
- package/dist/types/index.mjs.map +0 -1
- package/dist/typings.d.mts +0 -5
- package/dist/typings.d.ts +0 -5
- package/dist/typings.js +0 -2
- package/dist/typings.js.map +0 -1
- package/dist/typings.mjs +0 -1
- package/dist/typings.mjs.map +0 -1
- package/dist/utils/signal.d.mts +0 -21
- package/dist/utils/signal.d.ts +0 -21
- package/dist/utils/signal.js +0 -2
- package/dist/utils/signal.js.map +0 -1
- package/dist/utils/signal.mjs +0 -2
- package/dist/utils/signal.mjs.map +0 -1
- /package/dist/{chunk-R6PIHRXD.mjs.map → chunk-6J4XVVL4.mjs.map} +0 -0
- /package/dist/{bootstrap/client.mjs.map → chunk-6TIBWNPX.mjs.map} +0 -0
- /package/dist/{chunk-KUU3KDAE.mjs.map → chunk-7YWJADOI.mjs.map} +0 -0
- /package/dist/{chunk-TZXZ3UZS.mjs.map → chunk-CATZUF3K.mjs.map} +0 -0
- /package/dist/{chunk-KATLDJ7Z.mjs.map → chunk-EQ62HPWY.mjs.map} +0 -0
- /package/dist/{chunk-SYOEMO4R.mjs.map → chunk-KR3OAQKX.mjs.map} +0 -0
- /package/dist/{chunk-77LPS2WP.mjs.map → chunk-PXNT5WYC.mjs.map} +0 -0
- /package/dist/{chunk-5AIBE2QR.mjs.map → chunk-XVIYQWRZ.mjs.map} +0 -0
- /package/dist/{chunk-SXUJOOQY.mjs.map → chunk-Y7QBWZVQ.mjs.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ValidationHandler } from './handlers/validation-handler/ValidationHandler.js';
|
|
2
2
|
import * as discord_js from 'discord.js';
|
|
3
|
-
import { Client, ChatInputCommandInteraction, ContextMenuCommandInteraction, AutocompleteInteraction, UserContextMenuCommandInteraction, MessageContextMenuCommandInteraction, PermissionsString, RESTPostAPIApplicationCommandsJSONBody
|
|
3
|
+
import { Client, ChatInputCommandInteraction, ContextMenuCommandInteraction, AutocompleteInteraction, Interaction, CacheType, UserContextMenuCommandInteraction, MessageContextMenuCommandInteraction, PermissionsString, RESTPostAPIApplicationCommandsJSONBody } from 'discord.js';
|
|
4
4
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -92,6 +92,146 @@ type CommandKitInteraction = ChatInputCommandInteraction | ContextMenuCommandInt
|
|
|
92
92
|
*/
|
|
93
93
|
type BuiltInValidation = ({}: BuiltInValidationParams) => boolean | void;
|
|
94
94
|
|
|
95
|
+
interface hCommandContext {
|
|
96
|
+
interaction: CommandKitInteraction;
|
|
97
|
+
command: CommandData;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* A handler for client application commands.
|
|
101
|
+
*/
|
|
102
|
+
declare class CommandHandler {
|
|
103
|
+
#private;
|
|
104
|
+
context: AsyncLocalStorage<hCommandContext> | null;
|
|
105
|
+
constructor({ ...options }: CommandHandlerOptions);
|
|
106
|
+
init(): Promise<void>;
|
|
107
|
+
handleCommands(): void;
|
|
108
|
+
get commands(): CommandFileObject[];
|
|
109
|
+
reloadCommands(type?: ReloadOptions): Promise<void>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Event handler options.
|
|
114
|
+
*/
|
|
115
|
+
interface EventHandlerOptions {
|
|
116
|
+
client: Client;
|
|
117
|
+
eventsPath: string;
|
|
118
|
+
commandKitInstance: CommandKit;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Private event handler data.
|
|
122
|
+
*/
|
|
123
|
+
interface EventHandlerData extends EventHandlerOptions {
|
|
124
|
+
events: {
|
|
125
|
+
name: string;
|
|
126
|
+
functions: Function[];
|
|
127
|
+
}[];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* A handler for client events.
|
|
132
|
+
*/
|
|
133
|
+
declare class EventHandler {
|
|
134
|
+
#private;
|
|
135
|
+
constructor({ ...options }: EventHandlerOptions);
|
|
136
|
+
init(): Promise<void>;
|
|
137
|
+
get events(): {
|
|
138
|
+
name: string;
|
|
139
|
+
functions: Function[];
|
|
140
|
+
}[];
|
|
141
|
+
reloadEvents(commandHandler?: CommandHandler): Promise<void>;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Options for instantiating a CommandKit handler.
|
|
146
|
+
*/
|
|
147
|
+
interface CommandKitOptions {
|
|
148
|
+
/**
|
|
149
|
+
* The Discord.js client object to use with CommandKit.
|
|
150
|
+
*/
|
|
151
|
+
client: Client;
|
|
152
|
+
/**
|
|
153
|
+
* The path to your commands directory.
|
|
154
|
+
*/
|
|
155
|
+
commandsPath?: string;
|
|
156
|
+
/**
|
|
157
|
+
* The path to your events directory.
|
|
158
|
+
*/
|
|
159
|
+
eventsPath?: string;
|
|
160
|
+
/**
|
|
161
|
+
* The path to the validations directory.
|
|
162
|
+
*/
|
|
163
|
+
validationsPath?: string;
|
|
164
|
+
/**
|
|
165
|
+
* List of development guild IDs to restrict devOnly commands to.
|
|
166
|
+
*/
|
|
167
|
+
devGuildIds?: string[];
|
|
168
|
+
/**
|
|
169
|
+
* List of developer user IDs to restrict devOnly commands to.
|
|
170
|
+
*/
|
|
171
|
+
devUserIds?: string[];
|
|
172
|
+
/**
|
|
173
|
+
* List of developer role IDs to restrict devOnly commands to.
|
|
174
|
+
*/
|
|
175
|
+
devRoleIds?: string[];
|
|
176
|
+
/**
|
|
177
|
+
* Skip CommandKit's built-in validations (for devOnly commands).
|
|
178
|
+
*/
|
|
179
|
+
skipBuiltInValidations?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Bulk register application commands instead of one-by-one.
|
|
182
|
+
*/
|
|
183
|
+
bulkRegister?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Options for experimental features.
|
|
186
|
+
*/
|
|
187
|
+
experimental?: {
|
|
188
|
+
/**
|
|
189
|
+
* Enable hooks. This allows you to utilize hooks such as `useInteraction()` to access the interaction object anywhere inside the command.
|
|
190
|
+
*/
|
|
191
|
+
hooks?: boolean;
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Private data for the CommandKit class.
|
|
196
|
+
*/
|
|
197
|
+
interface CommandKitData extends CommandKitOptions {
|
|
198
|
+
commandHandler?: CommandHandler;
|
|
199
|
+
eventHandler?: EventHandler;
|
|
200
|
+
validationHandler?: ValidationHandler;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Represents a command context.
|
|
204
|
+
*/
|
|
205
|
+
interface CommandContext<T extends Interaction, Cached extends CacheType> {
|
|
206
|
+
/**
|
|
207
|
+
* The interaction that triggered this command.
|
|
208
|
+
*/
|
|
209
|
+
interaction: Interaction<CacheType>;
|
|
210
|
+
/**
|
|
211
|
+
* The client that instantiated this command.
|
|
212
|
+
*/
|
|
213
|
+
client: Client;
|
|
214
|
+
/**
|
|
215
|
+
* The command data.
|
|
216
|
+
*/
|
|
217
|
+
handler: CommandKit;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Represents a command file.
|
|
221
|
+
*/
|
|
222
|
+
interface CommandFileObject {
|
|
223
|
+
data: CommandData;
|
|
224
|
+
options?: CommandOptions;
|
|
225
|
+
run: <Cached extends CacheType = CacheType>(ctx: CommandContext<Interaction, Cached>) => Awaited<void>;
|
|
226
|
+
autocomplete?: <Cached extends CacheType = CacheType>(ctx: CommandContext<Interaction, Cached>) => Awaited<void>;
|
|
227
|
+
filePath: string;
|
|
228
|
+
category: string | null;
|
|
229
|
+
[key: string]: any;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* A reload type for commands.
|
|
233
|
+
*/
|
|
234
|
+
type ReloadOptions = 'dev' | 'global' | ReloadType;
|
|
95
235
|
/**
|
|
96
236
|
* Props for command run functions.
|
|
97
237
|
*/
|
|
@@ -248,147 +388,6 @@ declare enum ReloadType {
|
|
|
248
388
|
Global = "global"
|
|
249
389
|
}
|
|
250
390
|
|
|
251
|
-
interface hCommandContext {
|
|
252
|
-
interaction: CommandKitInteraction;
|
|
253
|
-
command: CommandData;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* A handler for client application commands.
|
|
257
|
-
*/
|
|
258
|
-
declare class CommandHandler {
|
|
259
|
-
#private;
|
|
260
|
-
context: AsyncLocalStorage<hCommandContext> | null;
|
|
261
|
-
constructor({ ...options }: CommandHandlerOptions);
|
|
262
|
-
init(): Promise<void>;
|
|
263
|
-
handleCommands(): void;
|
|
264
|
-
get commands(): CommandFileObject[];
|
|
265
|
-
reloadCommands(type?: ReloadOptions): Promise<void>;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Event handler options.
|
|
270
|
-
*/
|
|
271
|
-
interface EventHandlerOptions {
|
|
272
|
-
client: Client;
|
|
273
|
-
eventsPath: string;
|
|
274
|
-
commandKitInstance: CommandKit;
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Private event handler data.
|
|
278
|
-
*/
|
|
279
|
-
interface EventHandlerData extends EventHandlerOptions {
|
|
280
|
-
events: {
|
|
281
|
-
name: string;
|
|
282
|
-
functions: Function[];
|
|
283
|
-
}[];
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* A handler for client events.
|
|
288
|
-
*/
|
|
289
|
-
declare class EventHandler {
|
|
290
|
-
#private;
|
|
291
|
-
constructor({ ...options }: EventHandlerOptions);
|
|
292
|
-
init(): Promise<void>;
|
|
293
|
-
get events(): {
|
|
294
|
-
name: string;
|
|
295
|
-
functions: Function[];
|
|
296
|
-
}[];
|
|
297
|
-
reloadEvents(commandHandler?: CommandHandler): Promise<void>;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Options for instantiating a CommandKit handler.
|
|
302
|
-
*/
|
|
303
|
-
interface CommandKitOptions {
|
|
304
|
-
/**
|
|
305
|
-
* The Discord.js client object to use with CommandKit.
|
|
306
|
-
*/
|
|
307
|
-
client: Client;
|
|
308
|
-
/**
|
|
309
|
-
* The path to your commands directory.
|
|
310
|
-
*/
|
|
311
|
-
commandsPath?: string;
|
|
312
|
-
/**
|
|
313
|
-
* The path to your events directory.
|
|
314
|
-
*/
|
|
315
|
-
eventsPath?: string;
|
|
316
|
-
/**
|
|
317
|
-
* The path to the validations directory.
|
|
318
|
-
*/
|
|
319
|
-
validationsPath?: string;
|
|
320
|
-
/**
|
|
321
|
-
* List of development guild IDs to restrict devOnly commands to.
|
|
322
|
-
*/
|
|
323
|
-
devGuildIds?: string[];
|
|
324
|
-
/**
|
|
325
|
-
* List of developer user IDs to restrict devOnly commands to.
|
|
326
|
-
*/
|
|
327
|
-
devUserIds?: string[];
|
|
328
|
-
/**
|
|
329
|
-
* List of developer role IDs to restrict devOnly commands to.
|
|
330
|
-
*/
|
|
331
|
-
devRoleIds?: string[];
|
|
332
|
-
/**
|
|
333
|
-
* Skip CommandKit's built-in validations (for devOnly commands).
|
|
334
|
-
*/
|
|
335
|
-
skipBuiltInValidations?: boolean;
|
|
336
|
-
/**
|
|
337
|
-
* Bulk register application commands instead of one-by-one.
|
|
338
|
-
*/
|
|
339
|
-
bulkRegister?: boolean;
|
|
340
|
-
/**
|
|
341
|
-
* Options for experimental features.
|
|
342
|
-
*/
|
|
343
|
-
experimental?: {
|
|
344
|
-
/**
|
|
345
|
-
* Enable hooks. This allows you to utilize hooks such as `useInteraction()` to access the interaction object anywhere inside the command.
|
|
346
|
-
*/
|
|
347
|
-
hooks?: boolean;
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* Private data for the CommandKit class.
|
|
352
|
-
*/
|
|
353
|
-
interface CommandKitData extends CommandKitOptions {
|
|
354
|
-
commandHandler?: CommandHandler;
|
|
355
|
-
eventHandler?: EventHandler;
|
|
356
|
-
validationHandler?: ValidationHandler;
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* Represents a command context.
|
|
360
|
-
*/
|
|
361
|
-
interface CommandContext<T extends Interaction, Cached extends CacheType> {
|
|
362
|
-
/**
|
|
363
|
-
* The interaction that triggered this command.
|
|
364
|
-
*/
|
|
365
|
-
interaction: Interaction<CacheType>;
|
|
366
|
-
/**
|
|
367
|
-
* The client that instantiated this command.
|
|
368
|
-
*/
|
|
369
|
-
client: Client;
|
|
370
|
-
/**
|
|
371
|
-
* The command data.
|
|
372
|
-
*/
|
|
373
|
-
handler: CommandKit;
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* Represents a command file.
|
|
377
|
-
*/
|
|
378
|
-
interface CommandFileObject {
|
|
379
|
-
data: CommandData;
|
|
380
|
-
options?: CommandOptions;
|
|
381
|
-
run: <Cached extends CacheType = CacheType>(ctx: CommandContext<Interaction, Cached>) => Awaited<void>;
|
|
382
|
-
autocomplete?: <Cached extends CacheType = CacheType>(ctx: CommandContext<Interaction, Cached>) => Awaited<void>;
|
|
383
|
-
filePath: string;
|
|
384
|
-
category: string | null;
|
|
385
|
-
[key: string]: any;
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* A reload type for commands.
|
|
389
|
-
*/
|
|
390
|
-
type ReloadOptions = 'dev' | 'global' | ReloadType;
|
|
391
|
-
|
|
392
391
|
declare class CommandKit {
|
|
393
392
|
#private;
|
|
394
393
|
static _instance: CommandKit | null;
|
|
@@ -396,7 +395,7 @@ declare class CommandKit {
|
|
|
396
395
|
* Create a new command and event handler with CommandKit.
|
|
397
396
|
*
|
|
398
397
|
* @param options - The default CommandKit configuration.
|
|
399
|
-
* @see {@link https://commandkit.js.org/
|
|
398
|
+
* @see {@link https://commandkit.js.org/guide/commandkit-setup}
|
|
400
399
|
*/
|
|
401
400
|
constructor(options: CommandKitOptions);
|
|
402
401
|
/**
|
|
@@ -449,4 +448,4 @@ declare class CommandKit {
|
|
|
449
448
|
get devRoleIds(): string[];
|
|
450
449
|
}
|
|
451
450
|
|
|
452
|
-
export { type AutocompleteProps as A, type BuiltInValidationParams as B, CommandKit as C, type EventHandlerOptions as E, type MessageContextMenuCommandProps as M,
|
|
451
|
+
export { type AutocompleteProps as A, type BuiltInValidationParams as B, CommandKit as C, type EventHandlerOptions as E, type MessageContextMenuCommandProps as M, type ReloadOptions as R, type SlashCommandProps as S, type UserContextMenuCommandProps as U, type ValidationProps as V, type CommandKitOptions as a, type CommandKitData as b, type CommandContext as c, type CommandFileObject as d, type CommandProps as e, type ContextMenuCommandProps as f, type CommandOptions as g, type CommandData as h, type CommandObject as i, ReloadType as j, type CommandHandlerOptions as k, type CommandHandlerData as l, type CommandKitInteraction as m, type BuiltInValidation as n, type hCommandContext as o, CommandHandler as p, type EventHandlerData as q, EventHandler as r };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ValidationHandler } from './handlers/validation-handler/ValidationHandler.mjs';
|
|
2
2
|
import * as discord_js from 'discord.js';
|
|
3
|
-
import { Client, ChatInputCommandInteraction, ContextMenuCommandInteraction, AutocompleteInteraction, UserContextMenuCommandInteraction, MessageContextMenuCommandInteraction, PermissionsString, RESTPostAPIApplicationCommandsJSONBody
|
|
3
|
+
import { Client, ChatInputCommandInteraction, ContextMenuCommandInteraction, AutocompleteInteraction, Interaction, CacheType, UserContextMenuCommandInteraction, MessageContextMenuCommandInteraction, PermissionsString, RESTPostAPIApplicationCommandsJSONBody } from 'discord.js';
|
|
4
4
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -92,6 +92,146 @@ type CommandKitInteraction = ChatInputCommandInteraction | ContextMenuCommandInt
|
|
|
92
92
|
*/
|
|
93
93
|
type BuiltInValidation = ({}: BuiltInValidationParams) => boolean | void;
|
|
94
94
|
|
|
95
|
+
interface hCommandContext {
|
|
96
|
+
interaction: CommandKitInteraction;
|
|
97
|
+
command: CommandData;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* A handler for client application commands.
|
|
101
|
+
*/
|
|
102
|
+
declare class CommandHandler {
|
|
103
|
+
#private;
|
|
104
|
+
context: AsyncLocalStorage<hCommandContext> | null;
|
|
105
|
+
constructor({ ...options }: CommandHandlerOptions);
|
|
106
|
+
init(): Promise<void>;
|
|
107
|
+
handleCommands(): void;
|
|
108
|
+
get commands(): CommandFileObject[];
|
|
109
|
+
reloadCommands(type?: ReloadOptions): Promise<void>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Event handler options.
|
|
114
|
+
*/
|
|
115
|
+
interface EventHandlerOptions {
|
|
116
|
+
client: Client;
|
|
117
|
+
eventsPath: string;
|
|
118
|
+
commandKitInstance: CommandKit;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Private event handler data.
|
|
122
|
+
*/
|
|
123
|
+
interface EventHandlerData extends EventHandlerOptions {
|
|
124
|
+
events: {
|
|
125
|
+
name: string;
|
|
126
|
+
functions: Function[];
|
|
127
|
+
}[];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* A handler for client events.
|
|
132
|
+
*/
|
|
133
|
+
declare class EventHandler {
|
|
134
|
+
#private;
|
|
135
|
+
constructor({ ...options }: EventHandlerOptions);
|
|
136
|
+
init(): Promise<void>;
|
|
137
|
+
get events(): {
|
|
138
|
+
name: string;
|
|
139
|
+
functions: Function[];
|
|
140
|
+
}[];
|
|
141
|
+
reloadEvents(commandHandler?: CommandHandler): Promise<void>;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Options for instantiating a CommandKit handler.
|
|
146
|
+
*/
|
|
147
|
+
interface CommandKitOptions {
|
|
148
|
+
/**
|
|
149
|
+
* The Discord.js client object to use with CommandKit.
|
|
150
|
+
*/
|
|
151
|
+
client: Client;
|
|
152
|
+
/**
|
|
153
|
+
* The path to your commands directory.
|
|
154
|
+
*/
|
|
155
|
+
commandsPath?: string;
|
|
156
|
+
/**
|
|
157
|
+
* The path to your events directory.
|
|
158
|
+
*/
|
|
159
|
+
eventsPath?: string;
|
|
160
|
+
/**
|
|
161
|
+
* The path to the validations directory.
|
|
162
|
+
*/
|
|
163
|
+
validationsPath?: string;
|
|
164
|
+
/**
|
|
165
|
+
* List of development guild IDs to restrict devOnly commands to.
|
|
166
|
+
*/
|
|
167
|
+
devGuildIds?: string[];
|
|
168
|
+
/**
|
|
169
|
+
* List of developer user IDs to restrict devOnly commands to.
|
|
170
|
+
*/
|
|
171
|
+
devUserIds?: string[];
|
|
172
|
+
/**
|
|
173
|
+
* List of developer role IDs to restrict devOnly commands to.
|
|
174
|
+
*/
|
|
175
|
+
devRoleIds?: string[];
|
|
176
|
+
/**
|
|
177
|
+
* Skip CommandKit's built-in validations (for devOnly commands).
|
|
178
|
+
*/
|
|
179
|
+
skipBuiltInValidations?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Bulk register application commands instead of one-by-one.
|
|
182
|
+
*/
|
|
183
|
+
bulkRegister?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Options for experimental features.
|
|
186
|
+
*/
|
|
187
|
+
experimental?: {
|
|
188
|
+
/**
|
|
189
|
+
* Enable hooks. This allows you to utilize hooks such as `useInteraction()` to access the interaction object anywhere inside the command.
|
|
190
|
+
*/
|
|
191
|
+
hooks?: boolean;
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Private data for the CommandKit class.
|
|
196
|
+
*/
|
|
197
|
+
interface CommandKitData extends CommandKitOptions {
|
|
198
|
+
commandHandler?: CommandHandler;
|
|
199
|
+
eventHandler?: EventHandler;
|
|
200
|
+
validationHandler?: ValidationHandler;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Represents a command context.
|
|
204
|
+
*/
|
|
205
|
+
interface CommandContext<T extends Interaction, Cached extends CacheType> {
|
|
206
|
+
/**
|
|
207
|
+
* The interaction that triggered this command.
|
|
208
|
+
*/
|
|
209
|
+
interaction: Interaction<CacheType>;
|
|
210
|
+
/**
|
|
211
|
+
* The client that instantiated this command.
|
|
212
|
+
*/
|
|
213
|
+
client: Client;
|
|
214
|
+
/**
|
|
215
|
+
* The command data.
|
|
216
|
+
*/
|
|
217
|
+
handler: CommandKit;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Represents a command file.
|
|
221
|
+
*/
|
|
222
|
+
interface CommandFileObject {
|
|
223
|
+
data: CommandData;
|
|
224
|
+
options?: CommandOptions;
|
|
225
|
+
run: <Cached extends CacheType = CacheType>(ctx: CommandContext<Interaction, Cached>) => Awaited<void>;
|
|
226
|
+
autocomplete?: <Cached extends CacheType = CacheType>(ctx: CommandContext<Interaction, Cached>) => Awaited<void>;
|
|
227
|
+
filePath: string;
|
|
228
|
+
category: string | null;
|
|
229
|
+
[key: string]: any;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* A reload type for commands.
|
|
233
|
+
*/
|
|
234
|
+
type ReloadOptions = 'dev' | 'global' | ReloadType;
|
|
95
235
|
/**
|
|
96
236
|
* Props for command run functions.
|
|
97
237
|
*/
|
|
@@ -248,147 +388,6 @@ declare enum ReloadType {
|
|
|
248
388
|
Global = "global"
|
|
249
389
|
}
|
|
250
390
|
|
|
251
|
-
interface hCommandContext {
|
|
252
|
-
interaction: CommandKitInteraction;
|
|
253
|
-
command: CommandData;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* A handler for client application commands.
|
|
257
|
-
*/
|
|
258
|
-
declare class CommandHandler {
|
|
259
|
-
#private;
|
|
260
|
-
context: AsyncLocalStorage<hCommandContext> | null;
|
|
261
|
-
constructor({ ...options }: CommandHandlerOptions);
|
|
262
|
-
init(): Promise<void>;
|
|
263
|
-
handleCommands(): void;
|
|
264
|
-
get commands(): CommandFileObject[];
|
|
265
|
-
reloadCommands(type?: ReloadOptions): Promise<void>;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Event handler options.
|
|
270
|
-
*/
|
|
271
|
-
interface EventHandlerOptions {
|
|
272
|
-
client: Client;
|
|
273
|
-
eventsPath: string;
|
|
274
|
-
commandKitInstance: CommandKit;
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Private event handler data.
|
|
278
|
-
*/
|
|
279
|
-
interface EventHandlerData extends EventHandlerOptions {
|
|
280
|
-
events: {
|
|
281
|
-
name: string;
|
|
282
|
-
functions: Function[];
|
|
283
|
-
}[];
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* A handler for client events.
|
|
288
|
-
*/
|
|
289
|
-
declare class EventHandler {
|
|
290
|
-
#private;
|
|
291
|
-
constructor({ ...options }: EventHandlerOptions);
|
|
292
|
-
init(): Promise<void>;
|
|
293
|
-
get events(): {
|
|
294
|
-
name: string;
|
|
295
|
-
functions: Function[];
|
|
296
|
-
}[];
|
|
297
|
-
reloadEvents(commandHandler?: CommandHandler): Promise<void>;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Options for instantiating a CommandKit handler.
|
|
302
|
-
*/
|
|
303
|
-
interface CommandKitOptions {
|
|
304
|
-
/**
|
|
305
|
-
* The Discord.js client object to use with CommandKit.
|
|
306
|
-
*/
|
|
307
|
-
client: Client;
|
|
308
|
-
/**
|
|
309
|
-
* The path to your commands directory.
|
|
310
|
-
*/
|
|
311
|
-
commandsPath?: string;
|
|
312
|
-
/**
|
|
313
|
-
* The path to your events directory.
|
|
314
|
-
*/
|
|
315
|
-
eventsPath?: string;
|
|
316
|
-
/**
|
|
317
|
-
* The path to the validations directory.
|
|
318
|
-
*/
|
|
319
|
-
validationsPath?: string;
|
|
320
|
-
/**
|
|
321
|
-
* List of development guild IDs to restrict devOnly commands to.
|
|
322
|
-
*/
|
|
323
|
-
devGuildIds?: string[];
|
|
324
|
-
/**
|
|
325
|
-
* List of developer user IDs to restrict devOnly commands to.
|
|
326
|
-
*/
|
|
327
|
-
devUserIds?: string[];
|
|
328
|
-
/**
|
|
329
|
-
* List of developer role IDs to restrict devOnly commands to.
|
|
330
|
-
*/
|
|
331
|
-
devRoleIds?: string[];
|
|
332
|
-
/**
|
|
333
|
-
* Skip CommandKit's built-in validations (for devOnly commands).
|
|
334
|
-
*/
|
|
335
|
-
skipBuiltInValidations?: boolean;
|
|
336
|
-
/**
|
|
337
|
-
* Bulk register application commands instead of one-by-one.
|
|
338
|
-
*/
|
|
339
|
-
bulkRegister?: boolean;
|
|
340
|
-
/**
|
|
341
|
-
* Options for experimental features.
|
|
342
|
-
*/
|
|
343
|
-
experimental?: {
|
|
344
|
-
/**
|
|
345
|
-
* Enable hooks. This allows you to utilize hooks such as `useInteraction()` to access the interaction object anywhere inside the command.
|
|
346
|
-
*/
|
|
347
|
-
hooks?: boolean;
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* Private data for the CommandKit class.
|
|
352
|
-
*/
|
|
353
|
-
interface CommandKitData extends CommandKitOptions {
|
|
354
|
-
commandHandler?: CommandHandler;
|
|
355
|
-
eventHandler?: EventHandler;
|
|
356
|
-
validationHandler?: ValidationHandler;
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* Represents a command context.
|
|
360
|
-
*/
|
|
361
|
-
interface CommandContext<T extends Interaction, Cached extends CacheType> {
|
|
362
|
-
/**
|
|
363
|
-
* The interaction that triggered this command.
|
|
364
|
-
*/
|
|
365
|
-
interaction: Interaction<CacheType>;
|
|
366
|
-
/**
|
|
367
|
-
* The client that instantiated this command.
|
|
368
|
-
*/
|
|
369
|
-
client: Client;
|
|
370
|
-
/**
|
|
371
|
-
* The command data.
|
|
372
|
-
*/
|
|
373
|
-
handler: CommandKit;
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* Represents a command file.
|
|
377
|
-
*/
|
|
378
|
-
interface CommandFileObject {
|
|
379
|
-
data: CommandData;
|
|
380
|
-
options?: CommandOptions;
|
|
381
|
-
run: <Cached extends CacheType = CacheType>(ctx: CommandContext<Interaction, Cached>) => Awaited<void>;
|
|
382
|
-
autocomplete?: <Cached extends CacheType = CacheType>(ctx: CommandContext<Interaction, Cached>) => Awaited<void>;
|
|
383
|
-
filePath: string;
|
|
384
|
-
category: string | null;
|
|
385
|
-
[key: string]: any;
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* A reload type for commands.
|
|
389
|
-
*/
|
|
390
|
-
type ReloadOptions = 'dev' | 'global' | ReloadType;
|
|
391
|
-
|
|
392
391
|
declare class CommandKit {
|
|
393
392
|
#private;
|
|
394
393
|
static _instance: CommandKit | null;
|
|
@@ -396,7 +395,7 @@ declare class CommandKit {
|
|
|
396
395
|
* Create a new command and event handler with CommandKit.
|
|
397
396
|
*
|
|
398
397
|
* @param options - The default CommandKit configuration.
|
|
399
|
-
* @see {@link https://commandkit.js.org/
|
|
398
|
+
* @see {@link https://commandkit.js.org/guide/commandkit-setup}
|
|
400
399
|
*/
|
|
401
400
|
constructor(options: CommandKitOptions);
|
|
402
401
|
/**
|
|
@@ -449,4 +448,4 @@ declare class CommandKit {
|
|
|
449
448
|
get devRoleIds(): string[];
|
|
450
449
|
}
|
|
451
450
|
|
|
452
|
-
export { type AutocompleteProps as A, type BuiltInValidationParams as B, CommandKit as C, type EventHandlerOptions as E, type MessageContextMenuCommandProps as M,
|
|
451
|
+
export { type AutocompleteProps as A, type BuiltInValidationParams as B, CommandKit as C, type EventHandlerOptions as E, type MessageContextMenuCommandProps as M, type ReloadOptions as R, type SlashCommandProps as S, type UserContextMenuCommandProps as U, type ValidationProps as V, type CommandKitOptions as a, type CommandKitData as b, type CommandContext as c, type CommandFileObject as d, type CommandProps as e, type ContextMenuCommandProps as f, type CommandOptions as g, type CommandData as h, type CommandObject as i, ReloadType as j, type CommandHandlerOptions as k, type CommandHandlerData as l, type CommandKitInteraction as m, type BuiltInValidation as n, type hCommandContext as o, CommandHandler as p, type EventHandlerData as q, EventHandler as r };
|
package/dist/CommandKit.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
|
-
export { C as CommandKit } from './CommandKit
|
|
2
|
+
export { C as CommandKit } from './CommandKit-D84HlsL0.mjs';
|
|
3
3
|
import './handlers/validation-handler/ValidationHandler.mjs';
|
|
4
4
|
import './handlers/validation-handler/typings.mjs';
|
|
5
5
|
import 'async_hooks';
|
package/dist/CommandKit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'discord.js';
|
|
2
|
-
export { C as CommandKit } from './CommandKit-
|
|
2
|
+
export { C as CommandKit } from './CommandKit-Co5QNlps.js';
|
|
3
3
|
import './handlers/validation-handler/ValidationHandler.js';
|
|
4
4
|
import './handlers/validation-handler/typings.js';
|
|
5
5
|
import 'async_hooks';
|
package/dist/CommandKit.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var CommandKit_exports={};__export(CommandKit_exports,{CommandKit:()=>CommandKit});module.exports=__toCommonJS(CommandKit_exports);var import_path=__toESM(require("path"));function toFileURL(filePath){return"file://"+import_path.default.resolve(filePath).replace(/\\\\|\\/g,"/")}__name(toFileURL,"toFileURL");var import_path2=__toESM(require("path")),import_promises=__toESM(require("fs/promises"));async function getFilePaths(directory,nesting){let filePaths=[];if(!directory)return filePaths;let files=await import_promises.default.readdir(directory,{withFileTypes:!0});for(let file of files){let filePath=import_path2.default.join(directory,file.name);file.isFile()&&filePaths.push(filePath),nesting&&file.isDirectory()&&(filePaths=[...filePaths,...await getFilePaths(filePath,!0)])}return filePaths}__name(getFilePaths,"getFilePaths");async function getFolderPaths(directory,nesting){let folderPaths=[];if(!directory)return folderPaths;let folders=await import_promises.default.readdir(directory,{withFileTypes:!0});for(let folder of folders){let folderPath=import_path2.default.join(directory,folder.name);folder.isDirectory()&&(folderPaths.push(folderPath),nesting&&(folderPaths=[...folderPaths,...await getFolderPaths(folderPath,!0)]))}return folderPaths}__name(getFolderPaths,"getFolderPaths");var import_rfdc=__toESM(require("rfdc")),clone=(0,import_rfdc.default)();var resetColor="\x1B[0m",colors_default={reset:text=>`${text}${resetColor}`,bright:text=>`\x1B[1m${text}${resetColor}`,dim:text=>`\x1B[2m${text}${resetColor}`,underscore:text=>`\x1B[4m${text}${resetColor}`,blink:text=>`\x1B[5m${text}${resetColor}`,reverse:text=>`\x1B[7m${text}${resetColor}`,hidden:text=>`\x1B[8m${text}${resetColor}`,black:text=>`\x1B[30m${text}${resetColor}`,red:text=>`\x1B[31m${text}${resetColor}`,green:text=>`\x1B[32m${text}${resetColor}`,yellow:text=>`\x1B[33m${text}${resetColor}`,blue:text=>`\x1B[34m${text}${resetColor}`,magenta:text=>`\x1B[35m${text}${resetColor}`,cyan:text=>`\x1B[36m${text}${resetColor}`,white:text=>`\x1B[37m${text}${resetColor}`,bgBlack:text=>`\x1B[40m${text}${resetColor}`,bgRed:text=>`\x1B[41m${text}${resetColor}`,bgGreen:text=>`\x1B[42m${text}${resetColor}`,bgYellow:text=>`\x1B[43m${text}${resetColor}`,bgBlue:text=>`\x1B[44m${text}${resetColor}`,bgMagenta:text=>`\x1B[45m${text}${resetColor}`,bgCyan:text=>`\x1B[46m${text}${resetColor}`,bgWhite:text=>`\x1B[47m${text}${resetColor}
|
|
1
|
+
"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var CommandKit_exports={};__export(CommandKit_exports,{CommandKit:()=>CommandKit});module.exports=__toCommonJS(CommandKit_exports);var import_path=__toESM(require("path"));function toFileURL(filePath){return"file://"+import_path.default.resolve(filePath).replace(/\\\\|\\/g,"/")}__name(toFileURL,"toFileURL");var import_path2=__toESM(require("path")),import_promises=__toESM(require("fs/promises"));async function getFilePaths(directory,nesting){let filePaths=[];if(!directory)return filePaths;let files=await import_promises.default.readdir(directory,{withFileTypes:!0});for(let file of files){let filePath=import_path2.default.join(directory,file.name);file.isFile()&&filePaths.push(filePath),nesting&&file.isDirectory()&&(filePaths=[...filePaths,...await getFilePaths(filePath,!0)])}return filePaths}__name(getFilePaths,"getFilePaths");async function getFolderPaths(directory,nesting){let folderPaths=[];if(!directory)return folderPaths;let folders=await import_promises.default.readdir(directory,{withFileTypes:!0});for(let folder of folders){let folderPath=import_path2.default.join(directory,folder.name);folder.isDirectory()&&(folderPaths.push(folderPath),nesting&&(folderPaths=[...folderPaths,...await getFolderPaths(folderPath,!0)]))}return folderPaths}__name(getFolderPaths,"getFolderPaths");var import_rfdc=__toESM(require("rfdc")),clone=(0,import_rfdc.default)();var resetColor="\x1B[0m",colors_default={reset:__name(text=>`${text}${resetColor}`,"reset"),bright:__name(text=>`\x1B[1m${text}${resetColor}`,"bright"),dim:__name(text=>`\x1B[2m${text}${resetColor}`,"dim"),underscore:__name(text=>`\x1B[4m${text}${resetColor}`,"underscore"),blink:__name(text=>`\x1B[5m${text}${resetColor}`,"blink"),reverse:__name(text=>`\x1B[7m${text}${resetColor}`,"reverse"),hidden:__name(text=>`\x1B[8m${text}${resetColor}`,"hidden"),black:__name(text=>`\x1B[30m${text}${resetColor}`,"black"),red:__name(text=>`\x1B[31m${text}${resetColor}`,"red"),green:__name(text=>`\x1B[32m${text}${resetColor}`,"green"),yellow:__name(text=>`\x1B[33m${text}${resetColor}`,"yellow"),blue:__name(text=>`\x1B[34m${text}${resetColor}`,"blue"),magenta:__name(text=>`\x1B[35m${text}${resetColor}`,"magenta"),cyan:__name(text=>`\x1B[36m${text}${resetColor}`,"cyan"),white:__name(text=>`\x1B[37m${text}${resetColor}`,"white"),bgBlack:__name(text=>`\x1B[40m${text}${resetColor}`,"bgBlack"),bgRed:__name(text=>`\x1B[41m${text}${resetColor}`,"bgRed"),bgGreen:__name(text=>`\x1B[42m${text}${resetColor}`,"bgGreen"),bgYellow:__name(text=>`\x1B[43m${text}${resetColor}`,"bgYellow"),bgBlue:__name(text=>`\x1B[44m${text}${resetColor}`,"bgBlue"),bgMagenta:__name(text=>`\x1B[45m${text}${resetColor}`,"bgMagenta"),bgCyan:__name(text=>`\x1B[46m${text}${resetColor}`,"bgCyan"),bgWhite:__name(text=>`\x1B[47m${text}${resetColor}`,"bgWhite")};async function loadCommandsWithRest(props){if(props.reloading)if(props.client.isReady())await handleLoading(props.client,props.commands,props.devGuildIds,props.reloading,props.type);else throw new Error(colors_default.red("Cannot reload commands when client is not ready."));else props.client.once("ready",async c=>{await handleLoading(c,props.commands,props.devGuildIds,props.reloading,props.type)})}__name(loadCommandsWithRest,"loadCommandsWithRest");async function handleLoading(client,commands,devGuildIds,reloading,type){commands=commands.filter(cmd=>!cmd.options?.deleted);let devOnlyCommands=commands.filter(cmd=>cmd.options?.devOnly),globalCommands=commands.filter(cmd=>!cmd.options?.devOnly);type==="dev"?await loadDevCommands(client,devOnlyCommands,devGuildIds,reloading):type==="global"?await loadGlobalCommands(client,globalCommands,reloading):(await loadDevCommands(client,devOnlyCommands,devGuildIds,reloading),await loadGlobalCommands(client,globalCommands,reloading))}__name(handleLoading,"handleLoading");async function loadGlobalCommands(client,commands,reloading){let requestBody=commands.map(cmd=>cmd.data);await client.application.commands.set(requestBody).catch(error=>{throw new Error(colors_default.red(`Error ${reloading?"reloading":"loading"} global application commands.
|
|
2
2
|
`),error)}),console.log(colors_default.green(`${reloading?"Reloaded":"Loaded"} ${requestBody.length} global commands.`))}__name(loadGlobalCommands,"loadGlobalCommands");async function loadDevCommands(client,commands,guildIds,reloading){let requestBody=commands.map(cmd=>cmd.data);for(let guildId of guildIds){let targetGuild=client.guilds.cache.get(guildId)||await client.guilds.fetch(guildId);if(!targetGuild){process.emitWarning(`Cannot ${reloading?"reload":"load"} commands in guild "${guildId}" - guild doesn't exist or client isn't part of the guild.`);continue}await targetGuild.commands.set(requestBody).catch(error=>{throw new Error(colors_default.red(`Error ${reloading?"reloading":"loading"} developer application commands in guild "${targetGuild?.name||guildId}".
|
|
3
3
|
`),error)}),console.log(colors_default.green(`${reloading?"Reloaded":"Loaded"} ${requestBody.length} developer commands in guild "${targetGuild.name}".`))}}__name(loadDevCommands,"loadDevCommands");function areSlashCommandsDifferent(appCommand,localCommand){if(appCommand.options||(appCommand.options=[]),localCommand.options||(localCommand.options=[]),appCommand.description||(appCommand.description=""),localCommand.description||(localCommand.description=""),localCommand.description!==appCommand.description||localCommand.options.length!==appCommand.options.length)return!0}__name(areSlashCommandsDifferent,"areSlashCommandsDifferent");async function registerCommands(props){if(props.reloading)if(props.client.isReady())await handleRegistration(props.client,props.commands,props.devGuildIds,props.type);else throw new Error(colors_default.red("Cannot reload commands when client is not ready."));else props.client.once("ready",async c=>{await handleRegistration(c,props.commands,props.devGuildIds,props.type)})}__name(registerCommands,"registerCommands");async function handleRegistration(client,commands,devGuildIds,type){let devOnlyCommands=commands.filter(cmd=>cmd.options?.devOnly),globalCommands=commands.filter(cmd=>!cmd.options?.devOnly);type==="dev"?await registerDevCommands(client,devOnlyCommands,devGuildIds):type==="global"?await registerGlobalCommands(client,globalCommands):(await registerDevCommands(client,devOnlyCommands,devGuildIds),await registerGlobalCommands(client,globalCommands))}__name(handleRegistration,"handleRegistration");async function registerGlobalCommands(client,commands){let appCommandsManager=client.application.commands;await appCommandsManager.fetch();for(let command of commands){let targetCommand=appCommandsManager.cache.find(cmd=>cmd.name===command.data.name);if(command.options?.deleted){targetCommand?(await targetCommand.delete().catch(error=>{throw new Error(colors_default.red(`Failed to delete command "${command.data.name}" globally.
|
|
4
4
|
`),error)}),console.log(colors_default.green(`Deleted command "${command.data.name}" globally.`))):process.emitWarning(colors_default.yellow(`Ignoring: Command "${command.data.name}" is globally marked as deleted.`));continue}if(targetCommand&&areSlashCommandsDifferent(targetCommand,command.data)){await targetCommand.edit(command.data).catch(error=>{throw new Error(colors_default.red(`Failed to edit command "${command.data.name}" globally.
|