commandkit 0.0.9 → 0.0.10

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.
Files changed (35) hide show
  1. package/dist/index.d.mts +51 -0
  2. package/dist/index.d.ts +51 -1
  3. package/dist/index.js +552 -15
  4. package/dist/index.mjs +517 -0
  5. package/package.json +21 -4
  6. package/.github/workflows/publish.yaml +0 -26
  7. package/CHANGELOG.md +0 -52
  8. package/dist/CommandKit.d.ts +0 -36
  9. package/dist/CommandKit.js +0 -57
  10. package/dist/handlers/command-handler/CommandHandler.d.ts +0 -12
  11. package/dist/handlers/command-handler/CommandHandler.js +0 -62
  12. package/dist/handlers/command-handler/functions/handleCommands.d.ts +0 -2
  13. package/dist/handlers/command-handler/functions/handleCommands.js +0 -50
  14. package/dist/handlers/command-handler/functions/registerCommands.d.ts +0 -2
  15. package/dist/handlers/command-handler/functions/registerCommands.js +0 -135
  16. package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.d.ts +0 -1
  17. package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.js +0 -17
  18. package/dist/handlers/command-handler/validations/botPermissions.d.ts +0 -1
  19. package/dist/handlers/command-handler/validations/botPermissions.js +0 -17
  20. package/dist/handlers/command-handler/validations/devOnly.d.ts +0 -1
  21. package/dist/handlers/command-handler/validations/devOnly.js +0 -29
  22. package/dist/handlers/command-handler/validations/guildOnly.d.ts +0 -1
  23. package/dist/handlers/command-handler/validations/guildOnly.js +0 -11
  24. package/dist/handlers/command-handler/validations/userPermissions.d.ts +0 -1
  25. package/dist/handlers/command-handler/validations/userPermissions.js +0 -17
  26. package/dist/handlers/event-handler/EventHandler.d.ts +0 -11
  27. package/dist/handlers/event-handler/EventHandler.js +0 -52
  28. package/dist/handlers/index.d.ts +0 -3
  29. package/dist/handlers/index.js +0 -19
  30. package/dist/handlers/validation-handler/ValidationHandler.d.ts +0 -7
  31. package/dist/handlers/validation-handler/ValidationHandler.js +0 -29
  32. package/dist/utils/get-paths.d.ts +0 -3
  33. package/dist/utils/get-paths.js +0 -42
  34. package/tsconfig.json +0 -14
  35. package/typings.d.ts +0 -63
package/dist/index.mjs ADDED
@@ -0,0 +1,517 @@
1
+ // src/utils/get-paths.ts
2
+ import path from "path";
3
+ import fs from "fs";
4
+ function getFilePaths(directory, nesting) {
5
+ let filePaths = [];
6
+ if (!directory)
7
+ return filePaths;
8
+ const files = fs.readdirSync(directory, { withFileTypes: true });
9
+ for (const file of files) {
10
+ const filePath = path.join(directory, file.name);
11
+ if (file.isFile()) {
12
+ filePaths.push(filePath);
13
+ }
14
+ if (nesting && file.isDirectory()) {
15
+ filePaths = [...filePaths, ...getFilePaths(filePath, true)];
16
+ }
17
+ }
18
+ return filePaths;
19
+ }
20
+ function getFolderPaths(directory, nesting) {
21
+ let folderPaths = [];
22
+ if (!directory)
23
+ return folderPaths;
24
+ const folders = fs.readdirSync(directory, { withFileTypes: true });
25
+ for (const folder of folders) {
26
+ const folderPath = path.join(directory, folder.name);
27
+ if (folder.isDirectory()) {
28
+ folderPaths.push(folderPath);
29
+ if (nesting) {
30
+ folderPaths = [...folderPaths, ...getFolderPaths(folderPath, true)];
31
+ }
32
+ }
33
+ }
34
+ return folderPaths;
35
+ }
36
+
37
+ // src/utils/resolve-file-url.ts
38
+ import path2 from "path";
39
+ function toFileURL(filePath) {
40
+ const resolvedPath = path2.resolve(filePath);
41
+ return "file://" + resolvedPath.replace(/\\/g, "/");
42
+ }
43
+
44
+ // src/handlers/command-handler/validations/botPermissions.ts
45
+ function botPermissions_default({
46
+ interaction,
47
+ targetCommand
48
+ }) {
49
+ const botMember = interaction.guild?.members.me;
50
+ if (targetCommand.options?.botPermissions && botMember) {
51
+ for (const permission of targetCommand.options.botPermissions) {
52
+ const hasPermission = botMember.permissions.has(permission);
53
+ if (!hasPermission) {
54
+ interaction.reply({
55
+ content: `\u274C I do not have enough permission to execute this command. Required permission: \`${permission}\``,
56
+ ephemeral: true
57
+ });
58
+ return true;
59
+ }
60
+ }
61
+ }
62
+ }
63
+
64
+ // src/handlers/command-handler/validations/devOnly.ts
65
+ function devOnly_default({
66
+ interaction,
67
+ targetCommand,
68
+ handlerData
69
+ }) {
70
+ if (targetCommand.options?.devOnly) {
71
+ if (interaction.inGuild() && !handlerData.devGuildIds.includes(interaction.guildId)) {
72
+ interaction.reply({
73
+ content: "\u274C This command can only be used inside development servers.",
74
+ ephemeral: true
75
+ });
76
+ return true;
77
+ }
78
+ const guildMember = interaction.guild?.members.cache.get(
79
+ interaction.user.id
80
+ );
81
+ const memberRoles = guildMember?.roles.cache;
82
+ let hasDevRole = false;
83
+ memberRoles?.forEach((role) => {
84
+ if (handlerData.devRoleIds?.includes(role.id)) {
85
+ hasDevRole = true;
86
+ }
87
+ });
88
+ const isDevUser = handlerData.devUserIds.includes(interaction.user.id) || hasDevRole;
89
+ if (!isDevUser) {
90
+ interaction.reply({
91
+ content: "\u274C This command can only be used by developers.",
92
+ ephemeral: true
93
+ });
94
+ return true;
95
+ }
96
+ }
97
+ }
98
+
99
+ // src/handlers/command-handler/validations/guildOnly.ts
100
+ function guildOnly_default({
101
+ interaction,
102
+ targetCommand
103
+ }) {
104
+ if (targetCommand.options?.guildOnly && !interaction.inGuild()) {
105
+ interaction.reply({
106
+ content: "\u274C This command can only be used inside a server.",
107
+ ephemeral: true
108
+ });
109
+ return true;
110
+ }
111
+ }
112
+
113
+ // src/handlers/command-handler/validations/userPermissions.ts
114
+ function userPermissions_default({
115
+ interaction,
116
+ targetCommand
117
+ }) {
118
+ const memberPermissions = interaction.memberPermissions;
119
+ if (targetCommand.options?.userPermissions && memberPermissions) {
120
+ for (const permission of targetCommand.options.userPermissions) {
121
+ const hasPermission = memberPermissions.has(permission);
122
+ if (!hasPermission) {
123
+ interaction.reply({
124
+ content: `\u274C You do not have enough permission to run this command. Required permission: \`${permission}\``,
125
+ ephemeral: true
126
+ });
127
+ return true;
128
+ }
129
+ }
130
+ }
131
+ }
132
+
133
+ // src/handlers/command-handler/validations/index.ts
134
+ var validations_default = [botPermissions_default, devOnly_default, guildOnly_default, userPermissions_default];
135
+
136
+ // src/handlers/command-handler/utils/areSlashCommandsDifferent.ts
137
+ function areSlashCommandsDifferent(appCommand, localCommand) {
138
+ if (!appCommand.options)
139
+ appCommand.options = [];
140
+ if (!localCommand.options)
141
+ localCommand.options = [];
142
+ if (!appCommand.description)
143
+ appCommand.description = "";
144
+ if (!localCommand.description)
145
+ localCommand.description = "";
146
+ if (localCommand.description !== appCommand.description || localCommand.options.length !== appCommand.options.length) {
147
+ return true;
148
+ }
149
+ }
150
+
151
+ // src/handlers/command-handler/functions/registerCommands.ts
152
+ import "colors";
153
+ async function registerCommands(commandHandler) {
154
+ const client = commandHandler._data.client;
155
+ const devGuildIds = commandHandler._data.devGuildIds;
156
+ const commands = commandHandler._data.commands;
157
+ client.once("ready", async () => {
158
+ const devGuilds = [];
159
+ for (const devGuildId of devGuildIds) {
160
+ const guild = client.guilds.cache.get(devGuildId);
161
+ if (!guild) {
162
+ console.log(`\u23E9 Ignoring: Guild ${devGuildId} does not exist or client isn't in this guild.`.yellow);
163
+ continue;
164
+ }
165
+ devGuilds.push(guild);
166
+ }
167
+ const appCommands = client.application?.commands;
168
+ await appCommands?.fetch();
169
+ const devGuildCommands = [];
170
+ for (const guild of devGuilds) {
171
+ const guildCommands = guild.commands;
172
+ await guildCommands?.fetch();
173
+ devGuildCommands.push(guildCommands);
174
+ }
175
+ for (const command of commands) {
176
+ if (command.options?.deleted) {
177
+ const targetCommand = appCommands?.cache.find((cmd) => cmd.name === command.data.name);
178
+ if (!targetCommand) {
179
+ console.log(`\u23E9 Ignoring: Command "${command.data.name}" is globally marked as deleted.`.yellow);
180
+ } else {
181
+ targetCommand.delete().then(() => {
182
+ console.log(`\u{1F6AE} Deleted command "${command.data.name}" globally.`.green);
183
+ });
184
+ }
185
+ for (const guildCommands of devGuildCommands) {
186
+ const targetCommand2 = guildCommands.cache.find((cmd) => cmd.name === command.data.name);
187
+ if (!targetCommand2) {
188
+ console.log(
189
+ `\u23E9 Ignoring: Command "${command.data.name}" is marked as deleted for ${guildCommands.guild.name}.`.yellow
190
+ );
191
+ } else {
192
+ targetCommand2.delete().then(() => {
193
+ console.log(
194
+ `\u{1F6AE} Deleted command "${command.data.name}" in ${guildCommands.guild.name}.`.green
195
+ );
196
+ });
197
+ }
198
+ }
199
+ continue;
200
+ }
201
+ let commandData = command.data;
202
+ let editedCommand = false;
203
+ const appGlobalCommand = appCommands?.cache.find((cmd) => cmd.name === command.data.name);
204
+ if (appGlobalCommand) {
205
+ const commandsAreDifferent = areSlashCommandsDifferent(appGlobalCommand, commandData);
206
+ if (commandsAreDifferent) {
207
+ appGlobalCommand.edit(commandData).then(() => {
208
+ console.log(`\u2705 Edited command "${commandData.name}" globally.`.green);
209
+ }).catch((error) => {
210
+ console.log(`\u274C Failed to edit command "${commandData.name}" globally.`.red);
211
+ console.error(error);
212
+ });
213
+ editedCommand = true;
214
+ }
215
+ }
216
+ for (const guildCommands of devGuildCommands) {
217
+ const appGuildCommand = guildCommands.cache.find((cmd) => cmd.name === commandData.name);
218
+ if (appGuildCommand) {
219
+ const commandsAreDifferent = areSlashCommandsDifferent(appGuildCommand, commandData);
220
+ if (commandsAreDifferent) {
221
+ appGuildCommand.edit(commandData).then(() => {
222
+ console.log(
223
+ `\u2705 Edited command "${commandData.name}" in ${guildCommands.guild.name}.`.green
224
+ );
225
+ }).catch((error) => {
226
+ console.log(
227
+ `\u274C Failed to edit command "${commandData.name}" in ${guildCommands.guild.name}.`.red
228
+ );
229
+ console.error(error);
230
+ });
231
+ editedCommand = true;
232
+ }
233
+ }
234
+ }
235
+ if (editedCommand)
236
+ continue;
237
+ if (command.options?.devOnly) {
238
+ if (!devGuilds.length) {
239
+ console.log(
240
+ `\u23E9 Ignoring: Cannot register command "${command.data.name}" as no valid "devGuildIds" were provided.`.yellow
241
+ );
242
+ continue;
243
+ }
244
+ for (const guild of devGuilds) {
245
+ const cmdExists = guild.commands.cache.some((cmd) => cmd.name === command.data.name);
246
+ if (cmdExists)
247
+ continue;
248
+ guild?.commands.create(command.data).then(() => {
249
+ console.log(`\u2705 Registered command "${command.data.name}" in ${guild.name}.`.green);
250
+ }).catch((error) => {
251
+ console.log(`\u274C Failed to register command "${command.data.name}" in ${guild.name}.`.red);
252
+ console.error(error);
253
+ });
254
+ }
255
+ } else {
256
+ const cmdExists = appCommands?.cache.some((cmd) => cmd.name === command.data.name);
257
+ if (cmdExists)
258
+ continue;
259
+ appCommands?.create(command.data).then(() => {
260
+ console.log(`\u2705 Registered command "${command.data.name}" globally.`.green);
261
+ }).catch((error) => {
262
+ console.log(`\u274C Failed to register command "${command.data.name}" globally.`.red);
263
+ console.error(error);
264
+ });
265
+ }
266
+ }
267
+ });
268
+ }
269
+
270
+ // src/handlers/command-handler/functions/handleCommands.ts
271
+ function handleCommands(commandHandler) {
272
+ const client = commandHandler._data.client;
273
+ client.on("interactionCreate", async (interaction) => {
274
+ if (!interaction.isChatInputCommand() && !interaction.isContextMenuCommand())
275
+ return;
276
+ const targetCommand = commandHandler._data.commands.find((cmd) => cmd.data.name === interaction.commandName);
277
+ if (!targetCommand)
278
+ return;
279
+ const { data, options, run, ...rest } = targetCommand;
280
+ const commandObj = {
281
+ data: targetCommand.data,
282
+ options: targetCommand.options,
283
+ ...rest
284
+ };
285
+ let canRun = true;
286
+ for (const validationFunction of commandHandler._data.customValidations) {
287
+ const stopValidationLoop = await validationFunction({
288
+ interaction,
289
+ client,
290
+ commandObj
291
+ });
292
+ if (stopValidationLoop) {
293
+ canRun = false;
294
+ break;
295
+ }
296
+ }
297
+ if (!canRun)
298
+ return;
299
+ if (!commandHandler._data.skipBuiltInValidations) {
300
+ for (const validation of commandHandler._data.builtInValidations) {
301
+ const stopValidationLoop = validation({
302
+ targetCommand,
303
+ interaction,
304
+ handlerData: commandHandler._data
305
+ });
306
+ if (stopValidationLoop) {
307
+ canRun = false;
308
+ break;
309
+ }
310
+ }
311
+ }
312
+ if (!canRun)
313
+ return;
314
+ targetCommand.run({ interaction, client });
315
+ });
316
+ }
317
+
318
+ // src/handlers/command-handler/CommandHandler.ts
319
+ import "colors";
320
+ var CommandHandler = class {
321
+ _data;
322
+ constructor({ ...options }) {
323
+ this._data = {
324
+ ...options,
325
+ builtInValidations: [],
326
+ commands: []
327
+ };
328
+ }
329
+ async init() {
330
+ await this.#buildCommands();
331
+ this.#buildValidations();
332
+ await this.#registerCommands();
333
+ this.#handleCommands();
334
+ }
335
+ async #buildCommands() {
336
+ const commandFilePaths = getFilePaths(this._data.commandsPath, true).filter(
337
+ (path3) => path3.endsWith(".js") || path3.endsWith(".ts")
338
+ );
339
+ for (const commandFilePath of commandFilePaths) {
340
+ const modulePath = toFileURL(commandFilePath);
341
+ let commandObj = await import(modulePath);
342
+ const compactFilePath = commandFilePath.split(process.cwd())[1] || commandFilePath;
343
+ if (commandObj.default)
344
+ commandObj = commandObj.default;
345
+ if (!commandObj.data) {
346
+ console.log(`\u23E9 Ignoring: Command ${compactFilePath} does not export "data".`.yellow);
347
+ continue;
348
+ }
349
+ if (!commandObj.run) {
350
+ console.log(`\u23E9 Ignoring: Command ${compactFilePath} does not export "run".`.yellow);
351
+ continue;
352
+ }
353
+ this._data.commands.push(commandObj);
354
+ }
355
+ }
356
+ #buildValidations() {
357
+ for (const validationFunction of validations_default) {
358
+ this._data.builtInValidations.push(validationFunction);
359
+ }
360
+ }
361
+ async #registerCommands() {
362
+ await registerCommands(this);
363
+ }
364
+ #handleCommands() {
365
+ handleCommands(this);
366
+ }
367
+ get commands() {
368
+ return this._data.commands;
369
+ }
370
+ };
371
+
372
+ // src/handlers/event-handler/EventHandler.ts
373
+ import "colors";
374
+ var EventHandler = class {
375
+ #data;
376
+ constructor({ ...options }) {
377
+ this.#data = {
378
+ ...options,
379
+ events: []
380
+ };
381
+ }
382
+ async init() {
383
+ await this.#buildEvents();
384
+ this.#registerEvents();
385
+ }
386
+ async #buildEvents() {
387
+ const eventFolderPaths = getFolderPaths(this.#data.eventsPath);
388
+ for (const eventFolderPath of eventFolderPaths) {
389
+ const eventName = eventFolderPath.replace(/\\/g, "/").split("/").pop();
390
+ const eventFilePaths = getFilePaths(eventFolderPath, true).filter(
391
+ (path3) => path3.endsWith(".js") || path3.endsWith(".ts")
392
+ );
393
+ const eventObj = {
394
+ name: eventName,
395
+ functions: []
396
+ };
397
+ this.#data.events.push(eventObj);
398
+ for (const eventFilePath of eventFilePaths) {
399
+ const modulePath = toFileURL(eventFilePath);
400
+ let eventFunction = (await import(modulePath)).default;
401
+ const compactFilePath = eventFilePath.split(process.cwd())[1] || eventFilePath;
402
+ if (typeof eventFunction !== "function") {
403
+ console.log(`\u23E9 Ignoring: Event ${compactFilePath} does not export a function.`.yellow);
404
+ continue;
405
+ }
406
+ eventObj.functions.push(eventFunction);
407
+ }
408
+ }
409
+ }
410
+ #registerEvents() {
411
+ const client = this.#data.client;
412
+ for (const eventObj of this.#data.events) {
413
+ client.on(eventObj.name, async (...params) => {
414
+ for (const eventFunction of eventObj.functions) {
415
+ const stopEventLoop = await eventFunction(...params, client);
416
+ if (stopEventLoop) {
417
+ break;
418
+ }
419
+ }
420
+ });
421
+ }
422
+ }
423
+ get events() {
424
+ return this.#data.events;
425
+ }
426
+ };
427
+
428
+ // src/handlers/validation-handler/ValidationHandler.ts
429
+ import "colors";
430
+ var ValidationHandler = class {
431
+ #data;
432
+ constructor({ ...options }) {
433
+ this.#data = {
434
+ ...options,
435
+ validations: []
436
+ };
437
+ }
438
+ async init() {
439
+ await this.#buildValidations();
440
+ }
441
+ async #buildValidations() {
442
+ const validationFilePaths = getFilePaths(this.#data.validationsPath, true).filter(
443
+ (path3) => path3.endsWith(".js") || path3.endsWith(".ts")
444
+ );
445
+ for (const validationFilePath of validationFilePaths) {
446
+ const modulePath = toFileURL(validationFilePath);
447
+ let validationFunction = (await import(modulePath)).default;
448
+ const compactFilePath = validationFilePath.split(process.cwd())[1] || validationFilePath;
449
+ if (typeof validationFunction !== "function") {
450
+ console.log(`\u23E9 Ignoring: Validation ${compactFilePath} does not export a function.`.yellow);
451
+ continue;
452
+ }
453
+ this.#data.validations.push(validationFunction);
454
+ }
455
+ }
456
+ get validations() {
457
+ return this.#data.validations;
458
+ }
459
+ };
460
+
461
+ // src/CommandKit.ts
462
+ import "colors";
463
+ var CommandKit = class {
464
+ #data;
465
+ constructor({ ...options }) {
466
+ if (!options.client) {
467
+ throw new Error('"client" is required when instantiating CommandKit.'.red);
468
+ }
469
+ if (options.validationsPath && !options.commandsPath) {
470
+ throw new Error('"commandsPath" is required when "validationsPath" is set.'.red);
471
+ }
472
+ this.#data = {
473
+ ...options,
474
+ commands: []
475
+ };
476
+ this.#init();
477
+ }
478
+ async #init() {
479
+ if (this.#data.eventsPath) {
480
+ const eventHandler = new EventHandler({
481
+ client: this.#data.client,
482
+ eventsPath: this.#data.eventsPath
483
+ });
484
+ await eventHandler.init();
485
+ }
486
+ let validationFunctions = [];
487
+ if (this.#data.validationsPath) {
488
+ const validationHandler = new ValidationHandler({
489
+ validationsPath: this.#data.validationsPath
490
+ });
491
+ await validationHandler.init();
492
+ validationHandler.validations.forEach((v) => validationFunctions.push(v));
493
+ }
494
+ if (this.#data.commandsPath) {
495
+ const commandHandler = new CommandHandler({
496
+ client: this.#data.client,
497
+ commandsPath: this.#data.commandsPath,
498
+ devGuildIds: this.#data.devGuildIds || [],
499
+ devUserIds: this.#data.devUserIds || [],
500
+ devRoleIds: this.#data.devRoleIds || [],
501
+ customValidations: validationFunctions,
502
+ skipBuiltInValidations: this.#data.skipBuiltInValidations || false
503
+ });
504
+ await commandHandler.init();
505
+ this.#data.commands = commandHandler.commands;
506
+ }
507
+ }
508
+ get commands() {
509
+ return this.#data.commands.map((cmd) => {
510
+ const { run, ...command } = cmd;
511
+ return command;
512
+ });
513
+ }
514
+ };
515
+ export {
516
+ CommandKit
517
+ };
package/package.json CHANGED
@@ -1,14 +1,24 @@
1
1
  {
2
2
  "name": "commandkit",
3
- "version": "0.0.9",
4
- "main": "dist/index.js",
3
+ "version": "0.0.10",
5
4
  "license": "MIT",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "require": "./dist/index.js",
11
+ "import": "./dist/index.mjs",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
6
15
  "scripts": {
7
- "build": "tsc"
16
+ "lint": "tsc",
17
+ "build": "yarn lint && tsup"
8
18
  },
9
19
  "repository": {
10
20
  "type": "git",
11
- "url": "https://github.com/notunderctrl/commandkit"
21
+ "url": "https://github.com/underctrl-io/commandkit"
12
22
  },
13
23
  "homepage": "https://commandkit.underctrl.io",
14
24
  "keywords": [
@@ -17,8 +27,15 @@
17
27
  "event handler",
18
28
  "command validations"
19
29
  ],
30
+ "dependencies": {
31
+ "colors": "^1.4.0"
32
+ },
20
33
  "devDependencies": {
21
34
  "discord.js": "^14.12.1",
35
+ "tsup": "^7.2.0",
22
36
  "typescript": "^5.1.6"
37
+ },
38
+ "peerDependencies": {
39
+ "discord.js": "^14"
23
40
  }
24
41
  }
@@ -1,26 +0,0 @@
1
- name: 'publish'
2
-
3
- on:
4
- push:
5
- branches: [master]
6
-
7
- jobs:
8
- release:
9
- name: 🚀 publish
10
- runs-on: ubuntu-latest
11
- steps:
12
- - name: 📚 checkout
13
- uses: actions/checkout@v3
14
- - name: 🟢 node
15
- uses: actions/setup-node@v2
16
- with:
17
- node-version: 16
18
- registry-url: https://registry.npmjs.org
19
- - name: 🍳 prepare
20
- run: |
21
- npm install
22
- npm run build
23
- - name: 🚚 publish
24
- run: npm publish
25
- env:
26
- NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
package/CHANGELOG.md DELETED
@@ -1,52 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
-
7
- ## [0.0.9] - 2023-08-09
8
-
9
- ### Added
10
-
11
- - Support for developer role IDs
12
- - Ability to skip built-in validations by setting `skipBuiltInValidations` to true inside the `CommandKit` constructor
13
-
14
- ### Changed
15
-
16
- - Change validations to run custom user validations first, then CommandKit's built-in validations.
17
-
18
- ## [0.0.8] - 2023-07-03
19
-
20
- ### Added
21
-
22
- - Support for nested files inside of each event folder.
23
-
24
- ## [0.0.7] - 2023-07-02
25
-
26
- ### Changed
27
-
28
- - Give validation functions access to the full command object (commandObj) excluding the run function (as that is handled by the command handler), as opposed to just the `data` and `options` properties.
29
-
30
- ## [0.0.6] - 2023-07-02
31
-
32
- ### Fixed
33
-
34
- - Fixed a bug where wrong event names were being registered on Windows.
35
-
36
- ## [0.0.5] - 2023-07-02
37
-
38
- ### Added
39
-
40
- - Ability to automatically update application commands (guilds and global) when there's changes to the description or number of options (slash commands only).
41
-
42
- ## [0.0.4] - 2023-07-01
43
-
44
- ### Updated
45
-
46
- - Update package.json with new URLs, scripts, and version
47
-
48
- ## [0.0.3] - 2023-07-01
49
-
50
- ## [0.0.2] - 2023-07-01
51
-
52
- ## [0.0.1] - N/A
@@ -1,36 +0,0 @@
1
- import { CommandKitOptions } from '../typings';
2
- export declare class CommandKit {
3
- private _data;
4
- constructor({ ...options }: CommandKitOptions);
5
- private _init;
6
- get commands(): ({
7
- data: import("@discordjs/builders").SlashCommandBuilder | {
8
- name: string;
9
- name_localizations?: any;
10
- description: string;
11
- dm_permission?: boolean | undefined;
12
- options?: import("discord.js").APIApplicationCommandOption[] | undefined;
13
- };
14
- options?: {
15
- guildOnly?: boolean | undefined;
16
- devOnly?: boolean | undefined;
17
- deleted?: boolean | undefined;
18
- userPermissions?: import("discord.js").PermissionResolvable[] | undefined;
19
- botPermissions?: import("discord.js").PermissionResolvable[] | undefined;
20
- } | undefined;
21
- } | {
22
- data: import("@discordjs/builders").ContextMenuCommandBuilder | {
23
- name: string;
24
- name_localizations?: any;
25
- type: import("@discordjs/builders").ContextMenuCommandType;
26
- dm_permission?: boolean | undefined;
27
- };
28
- options?: {
29
- guildOnly?: boolean | undefined;
30
- devOnly?: boolean | undefined;
31
- deleted?: boolean | undefined;
32
- userPermissions?: import("discord.js").PermissionResolvable[] | undefined;
33
- botPermissions?: import("discord.js").PermissionResolvable[] | undefined;
34
- } | undefined;
35
- })[];
36
- }