commandkit 0.1.6-dev.20231113071041 → 0.1.6-dev.20231124164249
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +175 -0
- package/dist/index.d.ts +175 -0
- package/dist/index.js +8 -17
- package/dist/index.mjs +8 -15
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,70 +1,228 @@
|
|
|
1
1
|
import { CommandInteraction, Client, ChatInputCommandInteraction, ContextMenuCommandInteraction, PermissionsString, APIApplicationCommandOption, ButtonInteraction, Awaitable, Message, InteractionCollectorOptions, ButtonBuilder } from 'discord.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Base props for commands.
|
|
5
|
+
*/
|
|
3
6
|
interface CommandProps {
|
|
7
|
+
/**
|
|
8
|
+
* Represents the command's interaction.
|
|
9
|
+
*/
|
|
4
10
|
interaction: CommandInteraction;
|
|
11
|
+
/**
|
|
12
|
+
* The client created in your main file.
|
|
13
|
+
*/
|
|
5
14
|
client: Client<true>;
|
|
15
|
+
/**
|
|
16
|
+
* The main CommandKit handler that instantiated this.
|
|
17
|
+
*/
|
|
6
18
|
handler: CommandKit;
|
|
7
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Props for slash command run functions.
|
|
22
|
+
*/
|
|
8
23
|
interface SlashCommandProps {
|
|
24
|
+
/**
|
|
25
|
+
* Represents the command's interaction.
|
|
26
|
+
*/
|
|
9
27
|
interaction: ChatInputCommandInteraction;
|
|
28
|
+
/**
|
|
29
|
+
* The client created in your main file.
|
|
30
|
+
*/
|
|
10
31
|
client: Client<true>;
|
|
32
|
+
/**
|
|
33
|
+
* The CommandKit handler that instantiated this.
|
|
34
|
+
*/
|
|
11
35
|
handler: CommandKit;
|
|
12
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Props for context menu command run functions.
|
|
39
|
+
*/
|
|
13
40
|
interface ContextMenuCommandProps {
|
|
41
|
+
/**
|
|
42
|
+
* Represents the command's interaction.
|
|
43
|
+
*/
|
|
14
44
|
interaction: ContextMenuCommandInteraction;
|
|
45
|
+
/**
|
|
46
|
+
* The client created in your main file.
|
|
47
|
+
*/
|
|
15
48
|
client: Client<true>;
|
|
49
|
+
/**
|
|
50
|
+
* The CommandKit handler that instantiated this.
|
|
51
|
+
*/
|
|
16
52
|
handler: CommandKit;
|
|
17
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Props for command validations.
|
|
56
|
+
*/
|
|
18
57
|
interface ValidationFunctionProps {
|
|
58
|
+
/**
|
|
59
|
+
* Represents the command's interaction.
|
|
60
|
+
* Either a slash command or a context menu command interaction.
|
|
61
|
+
*/
|
|
19
62
|
interaction: ChatInputCommandInteraction | ContextMenuCommandInteraction;
|
|
63
|
+
/**
|
|
64
|
+
* The client created in your main file.
|
|
65
|
+
* Represented as a ready client (`Client<true>`).
|
|
66
|
+
*/
|
|
20
67
|
client: Client<true>;
|
|
68
|
+
/**
|
|
69
|
+
* The command object that is being validated.
|
|
70
|
+
*/
|
|
21
71
|
commandObj: CommandObject;
|
|
72
|
+
/**
|
|
73
|
+
* The CommandKit handler that instantiated this.
|
|
74
|
+
*/
|
|
22
75
|
handler: CommandKit;
|
|
23
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Configuration for commands.
|
|
79
|
+
*/
|
|
24
80
|
interface CommandOptions {
|
|
81
|
+
/**
|
|
82
|
+
* Boolean indicating whether the command is guild-only.
|
|
83
|
+
* @deprecated - Use `dm_permission` in the command's data instead.
|
|
84
|
+
*/
|
|
25
85
|
guildOnly?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Boolean indicating whether the command is developer only.
|
|
88
|
+
*/
|
|
26
89
|
devOnly?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Boolean indicating whether the command is deleted and should not be registered.
|
|
92
|
+
*/
|
|
27
93
|
deleted?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* An array of user permissions.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* userPermissions: ['BanMembers']
|
|
99
|
+
*/
|
|
28
100
|
userPermissions?: PermissionsString[];
|
|
101
|
+
/**
|
|
102
|
+
* An array of bot permissions.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* botPermissions: ['BanMembers']
|
|
106
|
+
*/
|
|
29
107
|
botPermissions?: PermissionsString[];
|
|
30
108
|
[key: string]: any;
|
|
31
109
|
}
|
|
32
110
|
declare enum CommandType {
|
|
111
|
+
/**
|
|
112
|
+
* Slash commands.
|
|
113
|
+
*/
|
|
33
114
|
'ChatInput' = 1,
|
|
115
|
+
/**
|
|
116
|
+
* Message context menu commands.
|
|
117
|
+
*/
|
|
34
118
|
'Message' = 3,
|
|
119
|
+
/**
|
|
120
|
+
* User context menu commands.
|
|
121
|
+
*/
|
|
35
122
|
'User' = 2
|
|
36
123
|
}
|
|
37
124
|
type LocaleString = 'id' | `en-${'GB' | 'US'}` | 'bg' | `zh-${'CN' | 'TW'}` | 'hr' | 'cs' | 'da' | 'nl' | 'fi' | 'fr' | 'de' | 'el' | 'hi' | 'hu' | 'it' | 'ja' | 'ko' | 'lt' | 'no' | 'pl' | 'pt-BR' | 'ro' | 'ru' | 'es-ES' | 'sv-SE' | 'th' | 'tr' | 'uk' | 'vi';
|
|
125
|
+
/**
|
|
126
|
+
* Common items for command data.
|
|
127
|
+
*/
|
|
38
128
|
type BaseCommandData = {
|
|
129
|
+
/**
|
|
130
|
+
* The name of the command.
|
|
131
|
+
*/
|
|
39
132
|
name: string;
|
|
133
|
+
/**
|
|
134
|
+
* The type of the command.
|
|
135
|
+
*/
|
|
40
136
|
type?: CommandType;
|
|
137
|
+
/**
|
|
138
|
+
* i18n for the command name.
|
|
139
|
+
*/
|
|
41
140
|
name_localizations?: Partial<Record<LocaleString, string | null>>;
|
|
141
|
+
/**
|
|
142
|
+
* Whether to allow this command in DMs.
|
|
143
|
+
*/
|
|
42
144
|
dm_permission?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Default permissions for members for the command.
|
|
147
|
+
*/
|
|
43
148
|
default_member_permissions?: string;
|
|
149
|
+
/**
|
|
150
|
+
* Whether the command is age-restricted.
|
|
151
|
+
*/
|
|
44
152
|
nsfw?: boolean;
|
|
45
153
|
};
|
|
154
|
+
/**
|
|
155
|
+
* Data for chat input commands.
|
|
156
|
+
*/
|
|
46
157
|
type ChatInputCommandData = BaseCommandData & {
|
|
158
|
+
/**
|
|
159
|
+
* The command's type.
|
|
160
|
+
*/
|
|
47
161
|
type?: CommandType.ChatInput;
|
|
162
|
+
/**
|
|
163
|
+
* The description of the command.
|
|
164
|
+
*/
|
|
48
165
|
description: string;
|
|
166
|
+
/**
|
|
167
|
+
* i18n for the command description.
|
|
168
|
+
*/
|
|
49
169
|
description_localizations?: Partial<Record<LocaleString, string | null>>;
|
|
170
|
+
/**
|
|
171
|
+
* Chat input command options.
|
|
172
|
+
*/
|
|
50
173
|
options?: Array<APIApplicationCommandOption>;
|
|
51
174
|
};
|
|
175
|
+
/**
|
|
176
|
+
* Represents any context menu command data.
|
|
177
|
+
*/
|
|
52
178
|
type UserOrMessageCommandData = BaseCommandData & {
|
|
53
179
|
type: CommandType.User | CommandType.Message;
|
|
54
180
|
};
|
|
55
181
|
type CommandData = ChatInputCommandData | UserOrMessageCommandData;
|
|
56
182
|
type CommandObject = {
|
|
183
|
+
/**
|
|
184
|
+
* Command data which is a slash command builder or raw JSON data.
|
|
185
|
+
* @example
|
|
186
|
+
* {
|
|
187
|
+
* name: 'ping',
|
|
188
|
+
* description: 'Replies with Pong!'
|
|
189
|
+
* }
|
|
190
|
+
*/
|
|
57
191
|
data: CommandData;
|
|
192
|
+
/**
|
|
193
|
+
* CommandKit command options.
|
|
194
|
+
* @example
|
|
195
|
+
* {
|
|
196
|
+
* devOnly: true,
|
|
197
|
+
* userPermissions: ['ManageGuild'],
|
|
198
|
+
* botPermissions: ['ManageGuild'],
|
|
199
|
+
* }
|
|
200
|
+
*/
|
|
58
201
|
options?: CommandOptions;
|
|
202
|
+
/**
|
|
203
|
+
* The path to the command file.
|
|
204
|
+
*/
|
|
59
205
|
filePath: string;
|
|
206
|
+
/**
|
|
207
|
+
* The command's category.
|
|
208
|
+
*/
|
|
60
209
|
category: string | null;
|
|
61
210
|
[key: string]: any;
|
|
62
211
|
};
|
|
63
212
|
declare enum ReloadType {
|
|
213
|
+
/**
|
|
214
|
+
* Reload developer/guild commands.
|
|
215
|
+
*/
|
|
64
216
|
Developer = "dev",
|
|
217
|
+
/**
|
|
218
|
+
* Reload global commands.
|
|
219
|
+
*/
|
|
65
220
|
Global = "global"
|
|
66
221
|
}
|
|
67
222
|
|
|
223
|
+
/**
|
|
224
|
+
* Options for instantiating a CommandKit handler.
|
|
225
|
+
*/
|
|
68
226
|
interface CommandKitOptions {
|
|
69
227
|
/**
|
|
70
228
|
* The Discord.js client object to use with CommandKit.
|
|
@@ -103,10 +261,18 @@ interface CommandKitOptions {
|
|
|
103
261
|
*/
|
|
104
262
|
bulkRegister?: boolean;
|
|
105
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* A reload type for commands.
|
|
266
|
+
*/
|
|
106
267
|
type ReloadOptions = 'dev' | 'global' | ReloadType;
|
|
107
268
|
|
|
108
269
|
declare class CommandKit {
|
|
109
270
|
#private;
|
|
271
|
+
/**
|
|
272
|
+
* Create a new handler with CommandKit.
|
|
273
|
+
* @param options - Options to use (client, commandsPath, eventsPath, etc.)
|
|
274
|
+
* @see {@link https://commandkit.js.org/docs/commandkit-setup}
|
|
275
|
+
*/
|
|
110
276
|
constructor(options: CommandKitOptions);
|
|
111
277
|
/**
|
|
112
278
|
* Updates application commands with the latest from "commandsPath".
|
|
@@ -204,7 +370,16 @@ type CommandKitSignal<T> = readonly [
|
|
|
204
370
|
(value: CommandKitSignalUpdater<T>) => void,
|
|
205
371
|
() => void
|
|
206
372
|
];
|
|
373
|
+
/**
|
|
374
|
+
* Creates a new signal.
|
|
375
|
+
* @param value - The initial value to use.
|
|
376
|
+
* @returns An array of functions: a getter, a setter, and a disposer.
|
|
377
|
+
*/
|
|
207
378
|
declare function createSignal<T = unknown>(value?: CommandKitSignalInitializer<T>): CommandKitSignal<T>;
|
|
379
|
+
/**
|
|
380
|
+
* Creates a new effect.
|
|
381
|
+
* @param callback - The callback function to execute.
|
|
382
|
+
*/
|
|
208
383
|
declare function createEffect(callback: CommandKitEffectCallback): void;
|
|
209
384
|
|
|
210
385
|
export { ButtonKit, CommandData, CommandKit, CommandKitButtonBuilderInteractionCollectorDispatch, CommandKitButtonBuilderInteractionCollectorDispatchContextData, CommandKitEffectCallback, CommandKitSignal, CommandKitSignalInitializer, CommandKitSignalUpdater, CommandObject, CommandOptions, CommandProps, CommandType, ContextMenuCommandProps, ReloadType, SlashCommandProps, ValidationFunctionProps, createEffect, createSignal };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,70 +1,228 @@
|
|
|
1
1
|
import { CommandInteraction, Client, ChatInputCommandInteraction, ContextMenuCommandInteraction, PermissionsString, APIApplicationCommandOption, ButtonInteraction, Awaitable, Message, InteractionCollectorOptions, ButtonBuilder } from 'discord.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Base props for commands.
|
|
5
|
+
*/
|
|
3
6
|
interface CommandProps {
|
|
7
|
+
/**
|
|
8
|
+
* Represents the command's interaction.
|
|
9
|
+
*/
|
|
4
10
|
interaction: CommandInteraction;
|
|
11
|
+
/**
|
|
12
|
+
* The client created in your main file.
|
|
13
|
+
*/
|
|
5
14
|
client: Client<true>;
|
|
15
|
+
/**
|
|
16
|
+
* The main CommandKit handler that instantiated this.
|
|
17
|
+
*/
|
|
6
18
|
handler: CommandKit;
|
|
7
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Props for slash command run functions.
|
|
22
|
+
*/
|
|
8
23
|
interface SlashCommandProps {
|
|
24
|
+
/**
|
|
25
|
+
* Represents the command's interaction.
|
|
26
|
+
*/
|
|
9
27
|
interaction: ChatInputCommandInteraction;
|
|
28
|
+
/**
|
|
29
|
+
* The client created in your main file.
|
|
30
|
+
*/
|
|
10
31
|
client: Client<true>;
|
|
32
|
+
/**
|
|
33
|
+
* The CommandKit handler that instantiated this.
|
|
34
|
+
*/
|
|
11
35
|
handler: CommandKit;
|
|
12
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Props for context menu command run functions.
|
|
39
|
+
*/
|
|
13
40
|
interface ContextMenuCommandProps {
|
|
41
|
+
/**
|
|
42
|
+
* Represents the command's interaction.
|
|
43
|
+
*/
|
|
14
44
|
interaction: ContextMenuCommandInteraction;
|
|
45
|
+
/**
|
|
46
|
+
* The client created in your main file.
|
|
47
|
+
*/
|
|
15
48
|
client: Client<true>;
|
|
49
|
+
/**
|
|
50
|
+
* The CommandKit handler that instantiated this.
|
|
51
|
+
*/
|
|
16
52
|
handler: CommandKit;
|
|
17
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Props for command validations.
|
|
56
|
+
*/
|
|
18
57
|
interface ValidationFunctionProps {
|
|
58
|
+
/**
|
|
59
|
+
* Represents the command's interaction.
|
|
60
|
+
* Either a slash command or a context menu command interaction.
|
|
61
|
+
*/
|
|
19
62
|
interaction: ChatInputCommandInteraction | ContextMenuCommandInteraction;
|
|
63
|
+
/**
|
|
64
|
+
* The client created in your main file.
|
|
65
|
+
* Represented as a ready client (`Client<true>`).
|
|
66
|
+
*/
|
|
20
67
|
client: Client<true>;
|
|
68
|
+
/**
|
|
69
|
+
* The command object that is being validated.
|
|
70
|
+
*/
|
|
21
71
|
commandObj: CommandObject;
|
|
72
|
+
/**
|
|
73
|
+
* The CommandKit handler that instantiated this.
|
|
74
|
+
*/
|
|
22
75
|
handler: CommandKit;
|
|
23
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Configuration for commands.
|
|
79
|
+
*/
|
|
24
80
|
interface CommandOptions {
|
|
81
|
+
/**
|
|
82
|
+
* Boolean indicating whether the command is guild-only.
|
|
83
|
+
* @deprecated - Use `dm_permission` in the command's data instead.
|
|
84
|
+
*/
|
|
25
85
|
guildOnly?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Boolean indicating whether the command is developer only.
|
|
88
|
+
*/
|
|
26
89
|
devOnly?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Boolean indicating whether the command is deleted and should not be registered.
|
|
92
|
+
*/
|
|
27
93
|
deleted?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* An array of user permissions.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* userPermissions: ['BanMembers']
|
|
99
|
+
*/
|
|
28
100
|
userPermissions?: PermissionsString[];
|
|
101
|
+
/**
|
|
102
|
+
* An array of bot permissions.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* botPermissions: ['BanMembers']
|
|
106
|
+
*/
|
|
29
107
|
botPermissions?: PermissionsString[];
|
|
30
108
|
[key: string]: any;
|
|
31
109
|
}
|
|
32
110
|
declare enum CommandType {
|
|
111
|
+
/**
|
|
112
|
+
* Slash commands.
|
|
113
|
+
*/
|
|
33
114
|
'ChatInput' = 1,
|
|
115
|
+
/**
|
|
116
|
+
* Message context menu commands.
|
|
117
|
+
*/
|
|
34
118
|
'Message' = 3,
|
|
119
|
+
/**
|
|
120
|
+
* User context menu commands.
|
|
121
|
+
*/
|
|
35
122
|
'User' = 2
|
|
36
123
|
}
|
|
37
124
|
type LocaleString = 'id' | `en-${'GB' | 'US'}` | 'bg' | `zh-${'CN' | 'TW'}` | 'hr' | 'cs' | 'da' | 'nl' | 'fi' | 'fr' | 'de' | 'el' | 'hi' | 'hu' | 'it' | 'ja' | 'ko' | 'lt' | 'no' | 'pl' | 'pt-BR' | 'ro' | 'ru' | 'es-ES' | 'sv-SE' | 'th' | 'tr' | 'uk' | 'vi';
|
|
125
|
+
/**
|
|
126
|
+
* Common items for command data.
|
|
127
|
+
*/
|
|
38
128
|
type BaseCommandData = {
|
|
129
|
+
/**
|
|
130
|
+
* The name of the command.
|
|
131
|
+
*/
|
|
39
132
|
name: string;
|
|
133
|
+
/**
|
|
134
|
+
* The type of the command.
|
|
135
|
+
*/
|
|
40
136
|
type?: CommandType;
|
|
137
|
+
/**
|
|
138
|
+
* i18n for the command name.
|
|
139
|
+
*/
|
|
41
140
|
name_localizations?: Partial<Record<LocaleString, string | null>>;
|
|
141
|
+
/**
|
|
142
|
+
* Whether to allow this command in DMs.
|
|
143
|
+
*/
|
|
42
144
|
dm_permission?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Default permissions for members for the command.
|
|
147
|
+
*/
|
|
43
148
|
default_member_permissions?: string;
|
|
149
|
+
/**
|
|
150
|
+
* Whether the command is age-restricted.
|
|
151
|
+
*/
|
|
44
152
|
nsfw?: boolean;
|
|
45
153
|
};
|
|
154
|
+
/**
|
|
155
|
+
* Data for chat input commands.
|
|
156
|
+
*/
|
|
46
157
|
type ChatInputCommandData = BaseCommandData & {
|
|
158
|
+
/**
|
|
159
|
+
* The command's type.
|
|
160
|
+
*/
|
|
47
161
|
type?: CommandType.ChatInput;
|
|
162
|
+
/**
|
|
163
|
+
* The description of the command.
|
|
164
|
+
*/
|
|
48
165
|
description: string;
|
|
166
|
+
/**
|
|
167
|
+
* i18n for the command description.
|
|
168
|
+
*/
|
|
49
169
|
description_localizations?: Partial<Record<LocaleString, string | null>>;
|
|
170
|
+
/**
|
|
171
|
+
* Chat input command options.
|
|
172
|
+
*/
|
|
50
173
|
options?: Array<APIApplicationCommandOption>;
|
|
51
174
|
};
|
|
175
|
+
/**
|
|
176
|
+
* Represents any context menu command data.
|
|
177
|
+
*/
|
|
52
178
|
type UserOrMessageCommandData = BaseCommandData & {
|
|
53
179
|
type: CommandType.User | CommandType.Message;
|
|
54
180
|
};
|
|
55
181
|
type CommandData = ChatInputCommandData | UserOrMessageCommandData;
|
|
56
182
|
type CommandObject = {
|
|
183
|
+
/**
|
|
184
|
+
* Command data which is a slash command builder or raw JSON data.
|
|
185
|
+
* @example
|
|
186
|
+
* {
|
|
187
|
+
* name: 'ping',
|
|
188
|
+
* description: 'Replies with Pong!'
|
|
189
|
+
* }
|
|
190
|
+
*/
|
|
57
191
|
data: CommandData;
|
|
192
|
+
/**
|
|
193
|
+
* CommandKit command options.
|
|
194
|
+
* @example
|
|
195
|
+
* {
|
|
196
|
+
* devOnly: true,
|
|
197
|
+
* userPermissions: ['ManageGuild'],
|
|
198
|
+
* botPermissions: ['ManageGuild'],
|
|
199
|
+
* }
|
|
200
|
+
*/
|
|
58
201
|
options?: CommandOptions;
|
|
202
|
+
/**
|
|
203
|
+
* The path to the command file.
|
|
204
|
+
*/
|
|
59
205
|
filePath: string;
|
|
206
|
+
/**
|
|
207
|
+
* The command's category.
|
|
208
|
+
*/
|
|
60
209
|
category: string | null;
|
|
61
210
|
[key: string]: any;
|
|
62
211
|
};
|
|
63
212
|
declare enum ReloadType {
|
|
213
|
+
/**
|
|
214
|
+
* Reload developer/guild commands.
|
|
215
|
+
*/
|
|
64
216
|
Developer = "dev",
|
|
217
|
+
/**
|
|
218
|
+
* Reload global commands.
|
|
219
|
+
*/
|
|
65
220
|
Global = "global"
|
|
66
221
|
}
|
|
67
222
|
|
|
223
|
+
/**
|
|
224
|
+
* Options for instantiating a CommandKit handler.
|
|
225
|
+
*/
|
|
68
226
|
interface CommandKitOptions {
|
|
69
227
|
/**
|
|
70
228
|
* The Discord.js client object to use with CommandKit.
|
|
@@ -103,10 +261,18 @@ interface CommandKitOptions {
|
|
|
103
261
|
*/
|
|
104
262
|
bulkRegister?: boolean;
|
|
105
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* A reload type for commands.
|
|
266
|
+
*/
|
|
106
267
|
type ReloadOptions = 'dev' | 'global' | ReloadType;
|
|
107
268
|
|
|
108
269
|
declare class CommandKit {
|
|
109
270
|
#private;
|
|
271
|
+
/**
|
|
272
|
+
* Create a new handler with CommandKit.
|
|
273
|
+
* @param options - Options to use (client, commandsPath, eventsPath, etc.)
|
|
274
|
+
* @see {@link https://commandkit.js.org/docs/commandkit-setup}
|
|
275
|
+
*/
|
|
110
276
|
constructor(options: CommandKitOptions);
|
|
111
277
|
/**
|
|
112
278
|
* Updates application commands with the latest from "commandsPath".
|
|
@@ -204,7 +370,16 @@ type CommandKitSignal<T> = readonly [
|
|
|
204
370
|
(value: CommandKitSignalUpdater<T>) => void,
|
|
205
371
|
() => void
|
|
206
372
|
];
|
|
373
|
+
/**
|
|
374
|
+
* Creates a new signal.
|
|
375
|
+
* @param value - The initial value to use.
|
|
376
|
+
* @returns An array of functions: a getter, a setter, and a disposer.
|
|
377
|
+
*/
|
|
207
378
|
declare function createSignal<T = unknown>(value?: CommandKitSignalInitializer<T>): CommandKitSignal<T>;
|
|
379
|
+
/**
|
|
380
|
+
* Creates a new effect.
|
|
381
|
+
* @param callback - The callback function to execute.
|
|
382
|
+
*/
|
|
208
383
|
declare function createEffect(callback: CommandKitEffectCallback): void;
|
|
209
384
|
|
|
210
385
|
export { ButtonKit, CommandData, CommandKit, CommandKitButtonBuilderInteractionCollectorDispatch, CommandKitButtonBuilderInteractionCollectorDispatchContextData, CommandKitEffectCallback, CommandKitSignal, CommandKitSignalInitializer, CommandKitSignalUpdater, CommandObject, CommandOptions, CommandProps, CommandType, ContextMenuCommandProps, ReloadType, SlashCommandProps, ValidationFunctionProps, createEffect, createSignal };
|
package/dist/index.js
CHANGED
|
@@ -32,8 +32,6 @@ var src_exports = {};
|
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
ButtonKit: () => ButtonKit,
|
|
34
34
|
CommandKit: () => CommandKit,
|
|
35
|
-
CommandType: () => CommandType,
|
|
36
|
-
ReloadType: () => ReloadType,
|
|
37
35
|
createEffect: () => createEffect,
|
|
38
36
|
createSignal: () => createSignal
|
|
39
37
|
});
|
|
@@ -787,6 +785,11 @@ var ValidationHandler = class {
|
|
|
787
785
|
// src/CommandKit.ts
|
|
788
786
|
var CommandKit = class {
|
|
789
787
|
#data;
|
|
788
|
+
/**
|
|
789
|
+
* Create a new handler with CommandKit.
|
|
790
|
+
* @param options - Options to use (client, commandsPath, eventsPath, etc.)
|
|
791
|
+
* @see {@link https://commandkit.js.org/docs/commandkit-setup}
|
|
792
|
+
*/
|
|
790
793
|
constructor(options) {
|
|
791
794
|
if (!options.client) {
|
|
792
795
|
throw new Error(colors_default.red('"client" is required when instantiating CommandKit.'));
|
|
@@ -799,6 +802,9 @@ var CommandKit = class {
|
|
|
799
802
|
this.#data = options;
|
|
800
803
|
this.#init();
|
|
801
804
|
}
|
|
805
|
+
/**
|
|
806
|
+
* (Private) Initialize CommandKit.
|
|
807
|
+
*/
|
|
802
808
|
async #init() {
|
|
803
809
|
if (this.#data.eventsPath) {
|
|
804
810
|
const eventHandler = new EventHandler({
|
|
@@ -1013,25 +1019,10 @@ function createEffect(callback) {
|
|
|
1013
1019
|
function getCurrentObserver() {
|
|
1014
1020
|
return context[context.length - 1];
|
|
1015
1021
|
}
|
|
1016
|
-
|
|
1017
|
-
// src/types/index.ts
|
|
1018
|
-
var CommandType = /* @__PURE__ */ ((CommandType2) => {
|
|
1019
|
-
CommandType2[CommandType2["ChatInput"] = 1] = "ChatInput";
|
|
1020
|
-
CommandType2[CommandType2["Message"] = 3] = "Message";
|
|
1021
|
-
CommandType2[CommandType2["User"] = 2] = "User";
|
|
1022
|
-
return CommandType2;
|
|
1023
|
-
})(CommandType || {});
|
|
1024
|
-
var ReloadType = /* @__PURE__ */ ((ReloadType2) => {
|
|
1025
|
-
ReloadType2["Developer"] = "dev";
|
|
1026
|
-
ReloadType2["Global"] = "global";
|
|
1027
|
-
return ReloadType2;
|
|
1028
|
-
})(ReloadType || {});
|
|
1029
1022
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1030
1023
|
0 && (module.exports = {
|
|
1031
1024
|
ButtonKit,
|
|
1032
1025
|
CommandKit,
|
|
1033
|
-
CommandType,
|
|
1034
|
-
ReloadType,
|
|
1035
1026
|
createEffect,
|
|
1036
1027
|
createSignal
|
|
1037
1028
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -754,6 +754,11 @@ var ValidationHandler = class {
|
|
|
754
754
|
// src/CommandKit.ts
|
|
755
755
|
var CommandKit = class {
|
|
756
756
|
#data;
|
|
757
|
+
/**
|
|
758
|
+
* Create a new handler with CommandKit.
|
|
759
|
+
* @param options - Options to use (client, commandsPath, eventsPath, etc.)
|
|
760
|
+
* @see {@link https://commandkit.js.org/docs/commandkit-setup}
|
|
761
|
+
*/
|
|
757
762
|
constructor(options) {
|
|
758
763
|
if (!options.client) {
|
|
759
764
|
throw new Error(colors_default.red('"client" is required when instantiating CommandKit.'));
|
|
@@ -766,6 +771,9 @@ var CommandKit = class {
|
|
|
766
771
|
this.#data = options;
|
|
767
772
|
this.#init();
|
|
768
773
|
}
|
|
774
|
+
/**
|
|
775
|
+
* (Private) Initialize CommandKit.
|
|
776
|
+
*/
|
|
769
777
|
async #init() {
|
|
770
778
|
if (this.#data.eventsPath) {
|
|
771
779
|
const eventHandler = new EventHandler({
|
|
@@ -984,24 +992,9 @@ function createEffect(callback) {
|
|
|
984
992
|
function getCurrentObserver() {
|
|
985
993
|
return context[context.length - 1];
|
|
986
994
|
}
|
|
987
|
-
|
|
988
|
-
// src/types/index.ts
|
|
989
|
-
var CommandType = /* @__PURE__ */ ((CommandType2) => {
|
|
990
|
-
CommandType2[CommandType2["ChatInput"] = 1] = "ChatInput";
|
|
991
|
-
CommandType2[CommandType2["Message"] = 3] = "Message";
|
|
992
|
-
CommandType2[CommandType2["User"] = 2] = "User";
|
|
993
|
-
return CommandType2;
|
|
994
|
-
})(CommandType || {});
|
|
995
|
-
var ReloadType = /* @__PURE__ */ ((ReloadType2) => {
|
|
996
|
-
ReloadType2["Developer"] = "dev";
|
|
997
|
-
ReloadType2["Global"] = "global";
|
|
998
|
-
return ReloadType2;
|
|
999
|
-
})(ReloadType || {});
|
|
1000
995
|
export {
|
|
1001
996
|
ButtonKit,
|
|
1002
997
|
CommandKit,
|
|
1003
|
-
CommandType,
|
|
1004
|
-
ReloadType,
|
|
1005
998
|
createEffect,
|
|
1006
999
|
createSignal
|
|
1007
1000
|
};
|
package/package.json
CHANGED