commandkit 0.0.9 → 0.1.0
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 +79 -0
- package/dist/index.d.ts +79 -1
- package/dist/index.js +652 -15
- package/dist/index.mjs +616 -0
- package/package.json +29 -5
- package/.github/workflows/publish.yaml +0 -26
- package/CHANGELOG.md +0 -52
- package/dist/CommandKit.d.ts +0 -36
- package/dist/CommandKit.js +0 -57
- package/dist/handlers/command-handler/CommandHandler.d.ts +0 -12
- package/dist/handlers/command-handler/CommandHandler.js +0 -62
- package/dist/handlers/command-handler/functions/handleCommands.d.ts +0 -2
- package/dist/handlers/command-handler/functions/handleCommands.js +0 -50
- package/dist/handlers/command-handler/functions/registerCommands.d.ts +0 -2
- package/dist/handlers/command-handler/functions/registerCommands.js +0 -135
- package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.d.ts +0 -1
- package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.js +0 -17
- package/dist/handlers/command-handler/validations/botPermissions.d.ts +0 -1
- package/dist/handlers/command-handler/validations/botPermissions.js +0 -17
- package/dist/handlers/command-handler/validations/devOnly.d.ts +0 -1
- package/dist/handlers/command-handler/validations/devOnly.js +0 -29
- package/dist/handlers/command-handler/validations/guildOnly.d.ts +0 -1
- package/dist/handlers/command-handler/validations/guildOnly.js +0 -11
- package/dist/handlers/command-handler/validations/userPermissions.d.ts +0 -1
- package/dist/handlers/command-handler/validations/userPermissions.js +0 -17
- package/dist/handlers/event-handler/EventHandler.d.ts +0 -11
- package/dist/handlers/event-handler/EventHandler.js +0 -52
- package/dist/handlers/index.d.ts +0 -3
- package/dist/handlers/index.js +0 -19
- package/dist/handlers/validation-handler/ValidationHandler.d.ts +0 -7
- package/dist/handlers/validation-handler/ValidationHandler.js +0 -29
- package/dist/utils/get-paths.d.ts +0 -3
- package/dist/utils/get-paths.js +0 -42
- package/tsconfig.json +0 -14
- package/typings.d.ts +0 -63
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Client, Interaction, CommandInteraction, ChatInputCommandInteraction, ContextMenuCommandInteraction, PermissionResolvable, APIApplicationCommandSubcommandOption, APIApplicationCommandSubcommandGroupOption } from 'discord.js';
|
|
2
|
+
|
|
3
|
+
interface CommandKitOptions {
|
|
4
|
+
client: Client;
|
|
5
|
+
commandsPath?: string;
|
|
6
|
+
eventsPath?: string;
|
|
7
|
+
validationsPath?: string;
|
|
8
|
+
devGuildIds?: string[];
|
|
9
|
+
devUserIds?: string[];
|
|
10
|
+
devRoleIds?: string[];
|
|
11
|
+
skipBuiltInValidations?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface CommandFileObject {
|
|
15
|
+
data: CommandData;
|
|
16
|
+
options?: CommandOptions;
|
|
17
|
+
run: ({}: { interaction: Interaction; client: Client; handler: CommandKit }) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface CommandProps {
|
|
21
|
+
interaction: CommandInteraction;
|
|
22
|
+
client: Client<true>;
|
|
23
|
+
handler: CommandKit;
|
|
24
|
+
}
|
|
25
|
+
interface SlashCommandProps {
|
|
26
|
+
interaction: ChatInputCommandInteraction;
|
|
27
|
+
client: Client<true>;
|
|
28
|
+
handler: CommandKit;
|
|
29
|
+
}
|
|
30
|
+
interface ContextMenuCommandProps {
|
|
31
|
+
interaction: ContextMenuCommandInteraction;
|
|
32
|
+
client: Client<true>;
|
|
33
|
+
handler: CommandKit;
|
|
34
|
+
}
|
|
35
|
+
interface ValidationFunctionProps {
|
|
36
|
+
interaction: ChatInputCommandInteraction | ContextMenuCommandInteraction;
|
|
37
|
+
client: Client<true>;
|
|
38
|
+
commandObj: CommandObject;
|
|
39
|
+
handler: CommandKit;
|
|
40
|
+
}
|
|
41
|
+
interface CommandOptions {
|
|
42
|
+
guildOnly?: boolean;
|
|
43
|
+
devOnly?: boolean;
|
|
44
|
+
deleted?: boolean;
|
|
45
|
+
userPermissions?: PermissionResolvable;
|
|
46
|
+
botPermissions?: PermissionResolvable;
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
}
|
|
49
|
+
declare enum CommandType {
|
|
50
|
+
'ChatInput' = 1,
|
|
51
|
+
'Message' = 3,
|
|
52
|
+
'User' = 2
|
|
53
|
+
}
|
|
54
|
+
type LocaleString = 'id' | 'en-US' | 'en-GB' | 'bg' | 'zh-CN' | 'zh-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';
|
|
55
|
+
type CommandData = {
|
|
56
|
+
name: string;
|
|
57
|
+
description: string;
|
|
58
|
+
type?: CommandType;
|
|
59
|
+
name_localizations?: Partial<Record<LocaleString, string | null>>;
|
|
60
|
+
description_localizations?: Partial<Record<LocaleString, string | null>>;
|
|
61
|
+
dm_permission?: boolean;
|
|
62
|
+
default_member_permissions?: string;
|
|
63
|
+
nsfw?: boolean;
|
|
64
|
+
options?: Array<APIApplicationCommandSubcommandOption | APIApplicationCommandSubcommandGroupOption>;
|
|
65
|
+
};
|
|
66
|
+
type CommandObject = Omit<CommandFileObject, 'run'>;
|
|
67
|
+
|
|
68
|
+
declare class CommandKit {
|
|
69
|
+
#private;
|
|
70
|
+
constructor({ ...options }: CommandKitOptions);
|
|
71
|
+
/**
|
|
72
|
+
* Returns all the commands that CommandKit is handling.
|
|
73
|
+
*
|
|
74
|
+
* @returns An array of command objects
|
|
75
|
+
*/
|
|
76
|
+
get commands(): CommandObject[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { CommandData, CommandKit, CommandObject, CommandOptions, CommandProps, CommandType, ContextMenuCommandProps, SlashCommandProps, ValidationFunctionProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,79 @@
|
|
|
1
|
-
|
|
1
|
+
import { Client, Interaction, CommandInteraction, ChatInputCommandInteraction, ContextMenuCommandInteraction, PermissionResolvable, APIApplicationCommandSubcommandOption, APIApplicationCommandSubcommandGroupOption } from 'discord.js';
|
|
2
|
+
|
|
3
|
+
interface CommandKitOptions {
|
|
4
|
+
client: Client;
|
|
5
|
+
commandsPath?: string;
|
|
6
|
+
eventsPath?: string;
|
|
7
|
+
validationsPath?: string;
|
|
8
|
+
devGuildIds?: string[];
|
|
9
|
+
devUserIds?: string[];
|
|
10
|
+
devRoleIds?: string[];
|
|
11
|
+
skipBuiltInValidations?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface CommandFileObject {
|
|
15
|
+
data: CommandData;
|
|
16
|
+
options?: CommandOptions;
|
|
17
|
+
run: ({}: { interaction: Interaction; client: Client; handler: CommandKit }) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface CommandProps {
|
|
21
|
+
interaction: CommandInteraction;
|
|
22
|
+
client: Client<true>;
|
|
23
|
+
handler: CommandKit;
|
|
24
|
+
}
|
|
25
|
+
interface SlashCommandProps {
|
|
26
|
+
interaction: ChatInputCommandInteraction;
|
|
27
|
+
client: Client<true>;
|
|
28
|
+
handler: CommandKit;
|
|
29
|
+
}
|
|
30
|
+
interface ContextMenuCommandProps {
|
|
31
|
+
interaction: ContextMenuCommandInteraction;
|
|
32
|
+
client: Client<true>;
|
|
33
|
+
handler: CommandKit;
|
|
34
|
+
}
|
|
35
|
+
interface ValidationFunctionProps {
|
|
36
|
+
interaction: ChatInputCommandInteraction | ContextMenuCommandInteraction;
|
|
37
|
+
client: Client<true>;
|
|
38
|
+
commandObj: CommandObject;
|
|
39
|
+
handler: CommandKit;
|
|
40
|
+
}
|
|
41
|
+
interface CommandOptions {
|
|
42
|
+
guildOnly?: boolean;
|
|
43
|
+
devOnly?: boolean;
|
|
44
|
+
deleted?: boolean;
|
|
45
|
+
userPermissions?: PermissionResolvable;
|
|
46
|
+
botPermissions?: PermissionResolvable;
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
}
|
|
49
|
+
declare enum CommandType {
|
|
50
|
+
'ChatInput' = 1,
|
|
51
|
+
'Message' = 3,
|
|
52
|
+
'User' = 2
|
|
53
|
+
}
|
|
54
|
+
type LocaleString = 'id' | 'en-US' | 'en-GB' | 'bg' | 'zh-CN' | 'zh-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';
|
|
55
|
+
type CommandData = {
|
|
56
|
+
name: string;
|
|
57
|
+
description: string;
|
|
58
|
+
type?: CommandType;
|
|
59
|
+
name_localizations?: Partial<Record<LocaleString, string | null>>;
|
|
60
|
+
description_localizations?: Partial<Record<LocaleString, string | null>>;
|
|
61
|
+
dm_permission?: boolean;
|
|
62
|
+
default_member_permissions?: string;
|
|
63
|
+
nsfw?: boolean;
|
|
64
|
+
options?: Array<APIApplicationCommandSubcommandOption | APIApplicationCommandSubcommandGroupOption>;
|
|
65
|
+
};
|
|
66
|
+
type CommandObject = Omit<CommandFileObject, 'run'>;
|
|
67
|
+
|
|
68
|
+
declare class CommandKit {
|
|
69
|
+
#private;
|
|
70
|
+
constructor({ ...options }: CommandKitOptions);
|
|
71
|
+
/**
|
|
72
|
+
* Returns all the commands that CommandKit is handling.
|
|
73
|
+
*
|
|
74
|
+
* @returns An array of command objects
|
|
75
|
+
*/
|
|
76
|
+
get commands(): CommandObject[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { CommandData, CommandKit, CommandObject, CommandOptions, CommandProps, CommandType, ContextMenuCommandProps, SlashCommandProps, ValidationFunctionProps };
|