commandkit 0.1.2 → 0.1.3-dev.20231002193305
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/README.md +9 -7
- package/dist/index.d.mts +74 -7
- package/dist/index.d.ts +74 -7
- package/dist/index.js +495 -281
- package/dist/index.mjs +501 -280
- package/package.json +48 -46
package/README.md
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
# CommandKit
|
|
7
7
|
|
|
8
|
-
CommandKit is a library that makes it easy to handle commands
|
|
8
|
+
CommandKit is a library that makes it easy to handle commands and events in your Discord.js projects.
|
|
9
9
|
|
|
10
10
|
**Supports Discord.js version 14**
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## Features
|
|
13
13
|
|
|
14
14
|
- Very beginner friendly 🚀
|
|
15
15
|
- Support for slash and context menu commands ✅
|
|
@@ -18,11 +18,11 @@ CommandKit is a library that makes it easy to handle commands (+ validations), a
|
|
|
18
18
|
- Supports multiple users as bot developers 👥
|
|
19
19
|
- Object oriented 💻
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
## Documentation
|
|
22
22
|
|
|
23
|
-
You can find the full documentation [here](https://commandkit.
|
|
23
|
+
You can find the full documentation [here](https://commandkit.js.org)
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
## Installation
|
|
26
26
|
|
|
27
27
|
[](https://nodei.co/npm/commandkit/)
|
|
28
28
|
|
|
@@ -54,9 +54,11 @@ To install the development version of CommandKit, run the following command:
|
|
|
54
54
|
npm install underctrl-io/commandkit#dev-build
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
> ⚠️ The development version is likely to have bugs.
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
## Usage
|
|
60
|
+
|
|
61
|
+
This is a simple overview of how to set up this library with all the options. You can read more in the [full documentation](https://commandkit.js.org)
|
|
60
62
|
|
|
61
63
|
```js
|
|
62
64
|
// index.js
|
package/dist/index.d.mts
CHANGED
|
@@ -1,21 +1,57 @@
|
|
|
1
1
|
import { Client, Interaction, CommandInteraction, ChatInputCommandInteraction, ContextMenuCommandInteraction, PermissionResolvable, APIApplicationCommandOption } from 'discord.js';
|
|
2
2
|
|
|
3
3
|
interface CommandKitOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The Discord.js client object to use with CommandKit.
|
|
6
|
+
*/
|
|
4
7
|
client: Client;
|
|
8
|
+
/**
|
|
9
|
+
* The path to your commands directory.
|
|
10
|
+
*/
|
|
5
11
|
commandsPath?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The path to your events directory.
|
|
14
|
+
*/
|
|
6
15
|
eventsPath?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The path to the validations directory.
|
|
18
|
+
*/
|
|
7
19
|
validationsPath?: string;
|
|
20
|
+
/**
|
|
21
|
+
* List of development guild IDs to restrict devOnly commands to.
|
|
22
|
+
*/
|
|
8
23
|
devGuildIds?: string[];
|
|
24
|
+
/**
|
|
25
|
+
* List of developer user IDs to restrict devOnly commands to.
|
|
26
|
+
*/
|
|
9
27
|
devUserIds?: string[];
|
|
28
|
+
/**
|
|
29
|
+
* List of developer role IDs to restrict devOnly commands to.
|
|
30
|
+
*/
|
|
10
31
|
devRoleIds?: string[];
|
|
32
|
+
/**
|
|
33
|
+
* Skip CommandKit's built-in validations (for devOnly commands).
|
|
34
|
+
*/
|
|
11
35
|
skipBuiltInValidations?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Uses discordjs/rest to register application commands.
|
|
38
|
+
* @experimental
|
|
39
|
+
*/
|
|
40
|
+
useRest?: boolean;
|
|
12
41
|
}
|
|
13
|
-
|
|
14
42
|
interface CommandFileObject {
|
|
15
43
|
data: CommandData;
|
|
16
44
|
options?: CommandOptions;
|
|
17
|
-
run: ({}: {
|
|
45
|
+
run: ({}: {
|
|
46
|
+
interaction: Interaction;
|
|
47
|
+
client: Client;
|
|
48
|
+
handler: CommandKit;
|
|
49
|
+
}) => void;
|
|
50
|
+
filePath: string;
|
|
51
|
+
category: string | null;
|
|
52
|
+
[key: string]: any;
|
|
18
53
|
}
|
|
54
|
+
type ReloadOptions = 'dev' | 'global' | ReloadType;
|
|
19
55
|
|
|
20
56
|
interface CommandProps {
|
|
21
57
|
interaction: CommandInteraction;
|
|
@@ -71,16 +107,47 @@ type UserOrMessageCommandData = BaseCommandData & {
|
|
|
71
107
|
};
|
|
72
108
|
type CommandData = ChatInputCommandData | UserOrMessageCommandData;
|
|
73
109
|
type CommandObject = Omit<CommandFileObject, 'run'>;
|
|
110
|
+
declare enum ReloadType {
|
|
111
|
+
'Developer' = "dev",
|
|
112
|
+
'Global' = "global"
|
|
113
|
+
}
|
|
74
114
|
|
|
75
115
|
declare class CommandKit {
|
|
76
116
|
#private;
|
|
77
|
-
constructor(
|
|
117
|
+
constructor(options: CommandKitOptions);
|
|
118
|
+
/**
|
|
119
|
+
* Updates application commands with the latest from "commandsPath".
|
|
120
|
+
* @experimental
|
|
121
|
+
*/
|
|
122
|
+
reloadCommands(type?: ReloadOptions): Promise<void>;
|
|
78
123
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* @returns An array of command objects
|
|
124
|
+
* @returns An array of objects of all the commands that CommandKit is handling.
|
|
82
125
|
*/
|
|
83
126
|
get commands(): CommandObject[];
|
|
127
|
+
/**
|
|
128
|
+
* @returns The path to the commands folder which was set when instantiating CommandKit.
|
|
129
|
+
*/
|
|
130
|
+
get commandsPath(): string | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* @returns The path to the events folder which was set when instantiating CommandKit.
|
|
133
|
+
*/
|
|
134
|
+
get eventsPath(): string | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* @returns The path to the validations folder which was set when instantiating CommandKit.
|
|
137
|
+
*/
|
|
138
|
+
get validationsPath(): string | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* @returns An array of all the developer user IDs which was set when instantiating CommandKit.
|
|
141
|
+
*/
|
|
142
|
+
get devUserIds(): string[];
|
|
143
|
+
/**
|
|
144
|
+
* @returns An array of all the developer guild IDs which was set when instantiating CommandKit.
|
|
145
|
+
*/
|
|
146
|
+
get devGuildIds(): string[];
|
|
147
|
+
/**
|
|
148
|
+
* @returns An array of all the developer role IDs which was set when instantiating CommandKit.
|
|
149
|
+
*/
|
|
150
|
+
get devRoleIds(): string[];
|
|
84
151
|
}
|
|
85
152
|
|
|
86
|
-
export { CommandData, CommandKit, CommandObject, CommandOptions, CommandProps, CommandType, ContextMenuCommandProps, SlashCommandProps, ValidationFunctionProps };
|
|
153
|
+
export { CommandData, CommandKit, CommandObject, CommandOptions, CommandProps, CommandType, ContextMenuCommandProps, ReloadType, SlashCommandProps, ValidationFunctionProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,57 @@
|
|
|
1
1
|
import { Client, Interaction, CommandInteraction, ChatInputCommandInteraction, ContextMenuCommandInteraction, PermissionResolvable, APIApplicationCommandOption } from 'discord.js';
|
|
2
2
|
|
|
3
3
|
interface CommandKitOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The Discord.js client object to use with CommandKit.
|
|
6
|
+
*/
|
|
4
7
|
client: Client;
|
|
8
|
+
/**
|
|
9
|
+
* The path to your commands directory.
|
|
10
|
+
*/
|
|
5
11
|
commandsPath?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The path to your events directory.
|
|
14
|
+
*/
|
|
6
15
|
eventsPath?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The path to the validations directory.
|
|
18
|
+
*/
|
|
7
19
|
validationsPath?: string;
|
|
20
|
+
/**
|
|
21
|
+
* List of development guild IDs to restrict devOnly commands to.
|
|
22
|
+
*/
|
|
8
23
|
devGuildIds?: string[];
|
|
24
|
+
/**
|
|
25
|
+
* List of developer user IDs to restrict devOnly commands to.
|
|
26
|
+
*/
|
|
9
27
|
devUserIds?: string[];
|
|
28
|
+
/**
|
|
29
|
+
* List of developer role IDs to restrict devOnly commands to.
|
|
30
|
+
*/
|
|
10
31
|
devRoleIds?: string[];
|
|
32
|
+
/**
|
|
33
|
+
* Skip CommandKit's built-in validations (for devOnly commands).
|
|
34
|
+
*/
|
|
11
35
|
skipBuiltInValidations?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Uses discordjs/rest to register application commands.
|
|
38
|
+
* @experimental
|
|
39
|
+
*/
|
|
40
|
+
useRest?: boolean;
|
|
12
41
|
}
|
|
13
|
-
|
|
14
42
|
interface CommandFileObject {
|
|
15
43
|
data: CommandData;
|
|
16
44
|
options?: CommandOptions;
|
|
17
|
-
run: ({}: {
|
|
45
|
+
run: ({}: {
|
|
46
|
+
interaction: Interaction;
|
|
47
|
+
client: Client;
|
|
48
|
+
handler: CommandKit;
|
|
49
|
+
}) => void;
|
|
50
|
+
filePath: string;
|
|
51
|
+
category: string | null;
|
|
52
|
+
[key: string]: any;
|
|
18
53
|
}
|
|
54
|
+
type ReloadOptions = 'dev' | 'global' | ReloadType;
|
|
19
55
|
|
|
20
56
|
interface CommandProps {
|
|
21
57
|
interaction: CommandInteraction;
|
|
@@ -71,16 +107,47 @@ type UserOrMessageCommandData = BaseCommandData & {
|
|
|
71
107
|
};
|
|
72
108
|
type CommandData = ChatInputCommandData | UserOrMessageCommandData;
|
|
73
109
|
type CommandObject = Omit<CommandFileObject, 'run'>;
|
|
110
|
+
declare enum ReloadType {
|
|
111
|
+
'Developer' = "dev",
|
|
112
|
+
'Global' = "global"
|
|
113
|
+
}
|
|
74
114
|
|
|
75
115
|
declare class CommandKit {
|
|
76
116
|
#private;
|
|
77
|
-
constructor(
|
|
117
|
+
constructor(options: CommandKitOptions);
|
|
118
|
+
/**
|
|
119
|
+
* Updates application commands with the latest from "commandsPath".
|
|
120
|
+
* @experimental
|
|
121
|
+
*/
|
|
122
|
+
reloadCommands(type?: ReloadOptions): Promise<void>;
|
|
78
123
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* @returns An array of command objects
|
|
124
|
+
* @returns An array of objects of all the commands that CommandKit is handling.
|
|
82
125
|
*/
|
|
83
126
|
get commands(): CommandObject[];
|
|
127
|
+
/**
|
|
128
|
+
* @returns The path to the commands folder which was set when instantiating CommandKit.
|
|
129
|
+
*/
|
|
130
|
+
get commandsPath(): string | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* @returns The path to the events folder which was set when instantiating CommandKit.
|
|
133
|
+
*/
|
|
134
|
+
get eventsPath(): string | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* @returns The path to the validations folder which was set when instantiating CommandKit.
|
|
137
|
+
*/
|
|
138
|
+
get validationsPath(): string | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* @returns An array of all the developer user IDs which was set when instantiating CommandKit.
|
|
141
|
+
*/
|
|
142
|
+
get devUserIds(): string[];
|
|
143
|
+
/**
|
|
144
|
+
* @returns An array of all the developer guild IDs which was set when instantiating CommandKit.
|
|
145
|
+
*/
|
|
146
|
+
get devGuildIds(): string[];
|
|
147
|
+
/**
|
|
148
|
+
* @returns An array of all the developer role IDs which was set when instantiating CommandKit.
|
|
149
|
+
*/
|
|
150
|
+
get devRoleIds(): string[];
|
|
84
151
|
}
|
|
85
152
|
|
|
86
|
-
export { CommandData, CommandKit, CommandObject, CommandOptions, CommandProps, CommandType, ContextMenuCommandProps, SlashCommandProps, ValidationFunctionProps };
|
|
153
|
+
export { CommandData, CommandKit, CommandObject, CommandOptions, CommandProps, CommandType, ContextMenuCommandProps, ReloadType, SlashCommandProps, ValidationFunctionProps };
|