reciple 6.0.0-dev.22 → 6.0.0-dev.25

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 (46) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +183 -183
  3. package/dist/lib/bin.mjs +66 -65
  4. package/dist/lib/esm.mjs +1 -1
  5. package/dist/lib/index.js +33 -35
  6. package/dist/lib/reciple/classes/RecipleClient.js +296 -296
  7. package/dist/lib/reciple/classes/RecipleConfig.js +106 -106
  8. package/dist/lib/reciple/classes/RecipleModule.js +94 -94
  9. package/dist/lib/reciple/classes/builders/MessageCommandBuilder.js +309 -325
  10. package/dist/lib/reciple/classes/builders/MessageCommandOptionBuilder.js +126 -107
  11. package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js +246 -246
  12. package/dist/lib/reciple/classes/managers/ApplicationCommandManager.js +178 -178
  13. package/dist/lib/reciple/classes/managers/CommandCooldownManager.js +99 -100
  14. package/dist/lib/reciple/classes/managers/CommandManager.js +59 -59
  15. package/dist/lib/reciple/classes/managers/MessageCommandOptionManager.js +25 -25
  16. package/dist/lib/reciple/classes/managers/ModuleManager.js +176 -179
  17. package/dist/lib/reciple/flags.js +31 -31
  18. package/dist/lib/reciple/permissions.js +30 -30
  19. package/dist/lib/reciple/types/builders.js +11 -11
  20. package/dist/lib/reciple/types/commands.js +15 -15
  21. package/dist/lib/reciple/types/paramOptions.js +2 -2
  22. package/dist/lib/reciple/util.js +69 -68
  23. package/dist/lib/reciple/version.js +47 -47
  24. package/dist/types/bin.d.mts +2 -2
  25. package/dist/types/esm.d.mts +1 -1
  26. package/dist/types/index.d.ts +17 -19
  27. package/dist/types/reciple/classes/RecipleClient.d.ts +104 -103
  28. package/dist/types/reciple/classes/RecipleConfig.d.ts +100 -100
  29. package/dist/types/reciple/classes/RecipleModule.d.ts +56 -56
  30. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts +189 -184
  31. package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts +53 -51
  32. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts +98 -98
  33. package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts +53 -53
  34. package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts +70 -70
  35. package/dist/types/reciple/classes/managers/CommandManager.d.ts +34 -36
  36. package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts +22 -22
  37. package/dist/types/reciple/classes/managers/ModuleManager.d.ts +49 -49
  38. package/dist/types/reciple/flags.d.ts +17 -17
  39. package/dist/types/reciple/permissions.d.ts +15 -19
  40. package/dist/types/reciple/types/builders.d.ts +205 -197
  41. package/dist/types/reciple/types/commands.d.ts +81 -81
  42. package/dist/types/reciple/types/paramOptions.d.ts +101 -101
  43. package/dist/types/reciple/util.d.ts +26 -23
  44. package/dist/types/reciple/version.d.ts +25 -25
  45. package/package.json +21 -20
  46. package/resource/reciple.yml +120 -120
@@ -1,49 +1,49 @@
1
- import { Collection } from 'discord.js';
2
- import { ModuleManagerGetModulePathsOptions, ModuleManagerLoadModulesOptions, ModuleManagerResolveModuleFilesOptions, ModuleManagerStartModulesOptions, ModuleManagerUnloadModulesOptions } from '../../types/paramOptions';
3
- import { RecipleClient } from '../RecipleClient';
4
- import { RecipleModule, RecipleScript } from '../RecipleModule';
5
- export interface ModuleManagerOptions {
6
- client: RecipleClient;
7
- modules?: (RecipleModule | RecipleScript)[];
8
- }
9
- export declare class ModuleManager {
10
- readonly client: RecipleClient;
11
- readonly modules: Collection<string, RecipleModule>;
12
- constructor(options: ModuleManagerOptions);
13
- /**
14
- * Start modules
15
- * @param options start modules options
16
- * @returns started modules
17
- */
18
- startModules(options: ModuleManagerStartModulesOptions): Promise<RecipleModule[]>;
19
- /**
20
- * Load modules
21
- * @param options load modules options
22
- * @returns loaded modules
23
- */
24
- loadModules(options?: ModuleManagerLoadModulesOptions): Promise<RecipleModule[]>;
25
- /**
26
- * Unload modules
27
- * @param options unload modules options
28
- * @returns unloaded modules
29
- */
30
- unloadModules(options?: ModuleManagerUnloadModulesOptions): Promise<RecipleModule[]>;
31
- /**
32
- * Resolve modules from file paths
33
- * @param options resolve module files options
34
- * @returns resolved modules
35
- */
36
- resolveModuleFiles(options: ModuleManagerResolveModuleFilesOptions): Promise<RecipleModule[]>;
37
- /**
38
- * Validate module script
39
- * @param script module script
40
- * @returns `true` if script is valid
41
- */
42
- static validateScript(script: unknown): script is RecipleScript;
43
- /**
44
- * Get module file paths from folders
45
- * @param options get module paths options
46
- * @returns module paths
47
- */
48
- getModulePaths(options?: ModuleManagerGetModulePathsOptions): Promise<string[]>;
49
- }
1
+ import { ModuleManagerGetModulePathsOptions, ModuleManagerLoadModulesOptions, ModuleManagerResolveModuleFilesOptions, ModuleManagerStartModulesOptions, ModuleManagerUnloadModulesOptions } from '../../types/paramOptions';
2
+ import { Collection } from 'discord.js';
3
+ import { RecipleModule, RecipleScript } from '../RecipleModule';
4
+ import { RecipleClient } from '../RecipleClient';
5
+ export interface ModuleManagerOptions {
6
+ client: RecipleClient;
7
+ modules?: (RecipleModule | RecipleScript)[];
8
+ }
9
+ export declare class ModuleManager {
10
+ readonly client: RecipleClient;
11
+ readonly modules: Collection<string, RecipleModule>;
12
+ constructor(options: ModuleManagerOptions);
13
+ /**
14
+ * Start modules
15
+ * @param options start modules options
16
+ * @returns started modules
17
+ */
18
+ startModules(options: ModuleManagerStartModulesOptions): Promise<RecipleModule[]>;
19
+ /**
20
+ * Load modules
21
+ * @param options load modules options
22
+ * @returns loaded modules
23
+ */
24
+ loadModules(options?: ModuleManagerLoadModulesOptions): Promise<RecipleModule[]>;
25
+ /**
26
+ * Unload modules
27
+ * @param options unload modules options
28
+ * @returns unloaded modules
29
+ */
30
+ unloadModules(options?: ModuleManagerUnloadModulesOptions): Promise<RecipleModule[]>;
31
+ /**
32
+ * Resolve modules from file paths
33
+ * @param options resolve module files options
34
+ * @returns resolved modules
35
+ */
36
+ resolveModuleFiles(options: ModuleManagerResolveModuleFilesOptions): Promise<RecipleModule[]>;
37
+ /**
38
+ * Validate module script
39
+ * @param script module script
40
+ * @returns `true` if script is valid
41
+ */
42
+ static validateScript(script: unknown): script is RecipleScript;
43
+ /**
44
+ * Get module file paths from folders
45
+ * @param options get module paths options
46
+ * @returns module paths
47
+ */
48
+ getModulePaths(options?: ModuleManagerGetModulePathsOptions): Promise<string[]>;
49
+ }
@@ -1,17 +1,17 @@
1
- import { Command } from 'commander';
2
- /**
3
- * Commander
4
- */
5
- export declare const commander: Command;
6
- /**
7
- * Used flags
8
- */
9
- export declare const flags: import("commander").OptionValues;
10
- /**
11
- * Token flag
12
- */
13
- export declare const token: string | undefined;
14
- /**
15
- * Current working directory
16
- */
17
- export declare const cwd: string;
1
+ import { Command } from 'commander';
2
+ /**
3
+ * Commander
4
+ */
5
+ export declare const commander: Command;
6
+ /**
7
+ * Used commander flags
8
+ */
9
+ export declare const flags: import("commander").OptionValues;
10
+ /**
11
+ * Token flag
12
+ */
13
+ export declare const token: string | undefined;
14
+ /**
15
+ * Current working directory
16
+ */
17
+ export declare const cwd: string;
@@ -1,19 +1,15 @@
1
- import { Guild, GuildTextBasedChannel, PermissionResolvable } from 'discord.js';
2
- import { UserHasCommandPermissionsOptions } from './types/paramOptions';
3
- /**
4
- * Check if the user has permissions to execute the given command name
5
- * @param options options
6
- */
7
- export declare function userHasCommandPermissions(options: UserHasCommandPermissionsOptions): boolean;
8
- /**
9
- * Check if the bot has the required permissions in a guild
10
- * @param guild Check if the bot has the required permissions in this guild
11
- * @param requiredPermissions Required guild bot permissions
12
- */
13
- export declare function botHasExecutePermissions(guild?: Guild, requiredPermissions?: PermissionResolvable[]): boolean;
14
- /**
15
- * Check if the bot has the required permissions in a channel
16
- * @param channel Check if the bot has the required permissions in this channel
17
- * @param requiredPermissions Required guild bot permissions
18
- */
19
- export declare function botHasExecutePermissions(channel?: GuildTextBasedChannel, requiredPermissions?: PermissionResolvable[]): boolean;
1
+ import { Guild, GuildTextBasedChannel, PermissionResolvable } from 'discord.js';
2
+ import { UserHasCommandPermissionsOptions } from './types/paramOptions';
3
+ /**
4
+ * Check if the user has permissions to execute the given command name
5
+ * @param options options
6
+ */
7
+ export declare function userHasCommandPermissions(options: UserHasCommandPermissionsOptions): boolean;
8
+ /**
9
+ * Check if the bot has the required permissions in a guild
10
+ * @param guildOrChannel Check if the bot has the required permissions in this guild or channel
11
+ * @param requiredPermissions Required guild bot permissions
12
+ */
13
+ export declare function botHasExecutePermissions(guildOrChannel?: Guild | GuildTextBasedChannel, requiredPermissions?: PermissionResolvable[]): boolean;
14
+ export declare function botHasExecutePermissions(guild?: Guild, requiredPermissions?: PermissionResolvable[]): boolean;
15
+ export declare function botHasExecutePermissions(channel?: GuildTextBasedChannel, requiredPermissions?: PermissionResolvable[]): boolean;
@@ -1,197 +1,205 @@
1
- import { ApplicationCommandOptionAllowedChannelTypes, ApplicationCommandOptionType, Awaitable, LocalizationMap, PermissionResolvable, RestOrArray, SlashCommandAttachmentOption, SlashCommandBooleanOption, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandUserOption } from 'discord.js';
2
- import { SlashCommandBuilder, SlashCommandExecuteData, SlashCommandExecuteFunction, SlashCommandHaltData, SlashCommandHaltFunction, SlashCommandOptionsOnlyBuilder, SlashCommandSubcommandsOnlyBuilder } from '../classes/builders/SlashCommandBuilder';
3
- import { MessageCommandBuilder, MessageCommandExecuteData, MessageCommandExecuteFunction, MessageCommandHaltData, MessageCommandHaltFunction } from '../classes/builders/MessageCommandBuilder';
4
- import { MessageCommandOptionBuilder } from '../classes/builders/MessageCommandOptionBuilder';
5
- /**
6
- * Any command builders
7
- */
8
- export declare type AnyCommandBuilder<T = unknown> = AnySlashCommandBuilder<T> | MessageCommandBuilder<T>;
9
- /**
10
- * Any command data
11
- */
12
- export declare type AnyCommandData<T = unknown> = SlashCommandData<T> | MessageCommandData<T>;
13
- /**
14
- * Any slash command builders
15
- */
16
- export declare type AnySlashCommandBuilder<T = unknown> = SlashCommandBuilder<T> | SlashCommandOptionsOnlyBuilder<T> | SlashCommandSubcommandsOnlyBuilder<T>;
17
- /**
18
- * Any command halt functions
19
- */
20
- export declare type AnyCommandHaltFunction<T = unknown> = SlashCommandHaltFunction<T> | MessageCommandHaltFunction<T>;
21
- /**
22
- * Any command execute function
23
- */
24
- export declare type AnyCommandExecuteFunction<T = unknown> = SlashCommandExecuteFunction<T> | MessageCommandExecuteFunction<T>;
25
- /**
26
- * Command halt function
27
- */
28
- export declare type CommandHaltFunction<T extends CommandType, M = unknown> = (haltData: T extends CommandType.SlashCommand ? SlashCommandHaltData<M> : T extends CommandType.MessageCommand ? MessageCommandHaltData<M> : SlashCommandHaltData<M> | MessageCommandHaltData<M>) => Awaitable<boolean | null | undefined | void>;
29
- /**
30
- * Command execute function
31
- */
32
- export declare type CommandExecuteFunction<T extends CommandType, M = unknown> = (executeData: T extends CommandType.SlashCommand ? SlashCommandExecuteData<M> : T extends CommandType.MessageCommand ? MessageCommandExecuteData<M> : SlashCommandExecuteData<M> | MessageCommandExecuteData<M>) => Awaitable<void>;
33
- /**
34
- * Message command options resolvable
35
- */
36
- export declare type MessageCommandOptionResolvable = MessageCommandOptionBuilder | MessageCommandOptionData;
37
- /**
38
- * Slash command options
39
- */
40
- export declare type AnySlashCommandOptionData = AnySlashCommandOptionsOnlyOptionData | SlashCommandSubCommandGroupData | SlashCommandSubCommandData;
41
- /**
42
- * Slash command options builders
43
- */
44
- export declare type AnySlashCommandOptionBuilder = AnySlashCommandOptionsOnlyOptionBuilder | SlashCommandSubcommandGroupBuilder | SlashCommandSubcommandBuilder;
45
- /**
46
- * Slash command options without sub commands
47
- */
48
- export declare type AnySlashCommandOptionsOnlyOptionData = SlashCommandAttachmentOptionData | SlashCommandBooleanOptionData | SlashCommandChannelOptionData | SlashCommandIntegerOptionData | SlashCommandMentionableOptionData | SlashCommandNumberOptionData | SlashCommandRoleOptionData | SlashCommandStringOptionData | SlashCommandUserOptionData;
49
- /**
50
- * Slash command option builder without sub commands
51
- */
52
- export declare type AnySlashCommandOptionsOnlyOptionBuilder = SlashCommandAttachmentOption | SlashCommandBooleanOption | SlashCommandChannelOption | SlashCommandIntegerOption | SlashCommandMentionableOption | SlashCommandNumberOption | SlashCommandRoleOption | SlashCommandStringOption | SlashCommandUserOption;
53
- /**
54
- * Types of command builders
55
- */
56
- export declare enum CommandType {
57
- SlashCommand = 1,
58
- MessageCommand = 2
59
- }
60
- /**
61
- * Shared command builder methods and properties
62
- */
63
- export interface SharedCommandBuilderProperties<T = unknown> {
64
- readonly type: CommandType;
65
- cooldown: number;
66
- requiredBotPermissions: PermissionResolvable[];
67
- requiredMemberPermissions: PermissionResolvable[];
68
- halt?: AnyCommandHaltFunction<T>;
69
- execute: AnyCommandExecuteFunction<T>;
70
- metadata?: T;
71
- /**
72
- * Sets the execute cooldown for this command.
73
- * - `0` means no cooldown
74
- * @param cooldown Command cooldown in milliseconds
75
- */
76
- setCooldown(cooldown: number): this;
77
- /**
78
- * Set required bot permissions to execute the command
79
- * @param permissions Bot's required permissions
80
- */
81
- setRequiredBotPermissions(...permissions: RestOrArray<PermissionResolvable>): this;
82
- /**
83
- * Set required permissions to execute the command
84
- * @param permissions User's return permissions
85
- */
86
- setRequiredMemberPermissions(...permissions: RestOrArray<PermissionResolvable>): this;
87
- /**
88
- * Function when the command is interupted
89
- * @param halt Function to execute when command is halted
90
- */
91
- setHalt(halt?: this['halt']): this;
92
- /**
93
- * Function when the command is executed
94
- * @param execute Function to execute when the command is called
95
- */
96
- setExecute(execute: this['execute']): this;
97
- /**
98
- * Set a command metadata
99
- * @param metadata Command metadata
100
- */
101
- setMetadata(metadata?: T): this;
102
- }
103
- /**
104
- * Shared command name and description properties
105
- */
106
- export interface SharedCommandDataProperties {
107
- name: string;
108
- description: string;
109
- }
110
- /**
111
- * Slash command object data interface
112
- */
113
- export interface SlashCommandData<T = unknown> extends SharedCommandDataProperties, Partial<Omit<SharedCommandBuilderProperties<T>, 'setCooldown' | 'setRequiredBotPermissions' | 'setRequiredMemberPermissions' | 'setHalt' | 'setExecute' | 'setMetadata' | 'halt' | 'execute'>> {
114
- type: CommandType.SlashCommand;
115
- nameLocalizations?: LocalizationMap;
116
- descriptionLocalizations?: LocalizationMap;
117
- options?: (AnySlashCommandOptionData | AnySlashCommandOptionBuilder)[];
118
- /**
119
- * @deprecated This property is deprecated and will be removed in the future.
120
- */
121
- defaultPermission?: boolean;
122
- defaultMemberPermissions?: string | null;
123
- dmPermission?: boolean;
124
- halt?: SlashCommandHaltFunction<T>;
125
- execute: SlashCommandExecuteFunction<T>;
126
- }
127
- export interface SharedSlashCommandOptionData<V = string | number> extends SharedCommandDataProperties, Pick<SlashCommandData, 'nameLocalizations' | 'descriptionLocalizations'> {
128
- choices?: {
129
- name: string;
130
- nameLocalizations?: LocalizationMap;
131
- value: V;
132
- }[];
133
- autocomplete?: boolean;
134
- required?: boolean;
135
- }
136
- export interface SlashCommandAttachmentOptionData extends Omit<SharedSlashCommandOptionData, 'choices' | 'autocomplete'> {
137
- type: ApplicationCommandOptionType.Attachment;
138
- }
139
- export interface SlashCommandBooleanOptionData extends Omit<SharedSlashCommandOptionData, 'choices' | 'autocomplete'> {
140
- type: ApplicationCommandOptionType.Boolean;
141
- }
142
- export interface SlashCommandChannelOptionData extends Omit<SharedSlashCommandOptionData, 'choices' | 'autocomplete'> {
143
- type: ApplicationCommandOptionType.Channel;
144
- channelTypes?: ApplicationCommandOptionAllowedChannelTypes[];
145
- }
146
- export interface SlashCommandIntegerOptionData extends SharedSlashCommandOptionData<number> {
147
- type: ApplicationCommandOptionType.Integer;
148
- minValue?: number;
149
- maxValue?: number;
150
- }
151
- export interface SlashCommandMentionableOptionData extends Omit<SharedSlashCommandOptionData, 'choices' | 'autocomplete'> {
152
- type: ApplicationCommandOptionType.Mentionable;
153
- }
154
- export interface SlashCommandNumberOptionData extends SharedSlashCommandOptionData<number> {
155
- type: ApplicationCommandOptionType.Number;
156
- minValue?: number;
157
- maxValue?: number;
158
- }
159
- export interface SlashCommandRoleOptionData extends Omit<SharedSlashCommandOptionData, 'choices' | 'autocomplete'> {
160
- type: ApplicationCommandOptionType.Role;
161
- }
162
- export interface SlashCommandStringOptionData extends SharedSlashCommandOptionData<string> {
163
- type: ApplicationCommandOptionType.String;
164
- minLength?: number;
165
- maxLength?: number;
166
- }
167
- export interface SlashCommandUserOptionData extends Omit<SharedSlashCommandOptionData, 'choices' | 'autocomplete'> {
168
- type: ApplicationCommandOptionType.User;
169
- }
170
- export interface SlashCommandSubCommandData extends SharedCommandDataProperties, Pick<SlashCommandData, 'nameLocalizations' | 'descriptionLocalizations'> {
171
- type: ApplicationCommandOptionType.Subcommand;
172
- options: (AnySlashCommandOptionsOnlyOptionData | AnySlashCommandOptionsOnlyOptionBuilder)[];
173
- }
174
- export interface SlashCommandSubCommandGroupData extends SharedCommandDataProperties, Pick<SlashCommandData, 'nameLocalizations' | 'descriptionLocalizations'> {
175
- type: ApplicationCommandOptionType.SubcommandGroup;
176
- options: (SlashCommandSubCommandData | SlashCommandSubcommandBuilder)[];
177
- }
178
- /**
179
- * Message command object data interface
180
- */
181
- export interface MessageCommandData<T = unknown> extends SharedCommandDataProperties, Partial<Omit<SharedCommandBuilderProperties<T>, 'setCooldown' | 'setRequiredBotPermissions' | 'setRequiredMemberPermissions' | 'setHalt' | 'setExecute' | 'setMetadata' | 'halt' | 'execute'>> {
182
- type: CommandType.MessageCommand;
183
- aliases?: string[];
184
- validateOptions?: boolean;
185
- allowExecuteInDM?: boolean;
186
- allowExecuteByBots?: boolean;
187
- halt?: MessageCommandHaltFunction<T>;
188
- execute: MessageCommandExecuteFunction<T>;
189
- options?: MessageCommandOptionResolvable[];
190
- }
191
- /**
192
- * Message command option object data interface
193
- */
194
- export interface MessageCommandOptionData extends SharedCommandDataProperties {
195
- required?: boolean;
196
- validator?: (value: string) => Awaitable<boolean>;
197
- }
1
+ import { SlashCommandBuilder, SlashCommandExecuteData, SlashCommandExecuteFunction, SlashCommandHaltData, SlashCommandHaltFunction, SlashCommandOptionsOnlyBuilder, SlashCommandSubcommandsOnlyBuilder } from '../classes/builders/SlashCommandBuilder';
2
+ import { MessageCommandBuilder, MessageCommandExecuteData, MessageCommandExecuteFunction, MessageCommandHaltData, MessageCommandHaltFunction } from '../classes/builders/MessageCommandBuilder';
3
+ import { MessageCommandOptionBuilder } from '../classes/builders/MessageCommandOptionBuilder';
4
+ import { ApplicationCommandOptionAllowedChannelTypes, ApplicationCommandOptionType, Awaitable, LocalizationMap, PermissionResolvable, RestOrArray, SlashCommandAttachmentOption, SlashCommandBooleanOption, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandUserOption } from 'discord.js';
5
+ /**
6
+ * Any command builders
7
+ */
8
+ export declare type AnyCommandBuilder<T = unknown> = AnySlashCommandBuilder<T> | MessageCommandBuilder<T>;
9
+ /**
10
+ * Any command data
11
+ */
12
+ export declare type AnyCommandData<T = unknown> = SlashCommandData<T> | MessageCommandData<T>;
13
+ /**
14
+ * Any slash command builders
15
+ */
16
+ export declare type AnySlashCommandBuilder<T = unknown> = SlashCommandBuilder<T> | SlashCommandOptionsOnlyBuilder<T> | SlashCommandSubcommandsOnlyBuilder<T>;
17
+ /**
18
+ * Any command halt functions
19
+ */
20
+ export declare type AnyCommandHaltFunction<T = unknown> = SlashCommandHaltFunction<T> | MessageCommandHaltFunction<T>;
21
+ /**
22
+ * Any command execute function
23
+ */
24
+ export declare type AnyCommandExecuteFunction<T = unknown> = SlashCommandExecuteFunction<T> | MessageCommandExecuteFunction<T>;
25
+ /**
26
+ * Command halt function
27
+ */
28
+ export declare type CommandHaltFunction<T extends CommandType, M = unknown> = (haltData: T extends CommandType.SlashCommand ? SlashCommandHaltData<M> : T extends CommandType.MessageCommand ? MessageCommandHaltData<M> : SlashCommandHaltData<M> | MessageCommandHaltData<M>) => Awaitable<boolean | null | undefined | void>;
29
+ /**
30
+ * Command execute function
31
+ */
32
+ export declare type CommandExecuteFunction<T extends CommandType, M = unknown> = (executeData: T extends CommandType.SlashCommand ? SlashCommandExecuteData<M> : T extends CommandType.MessageCommand ? MessageCommandExecuteData<M> : SlashCommandExecuteData<M> | MessageCommandExecuteData<M>) => Awaitable<void>;
33
+ /**
34
+ * Slash command options resolvable
35
+ */
36
+ export declare type SlashCommandResolvable<T = unknown, OptionsOnly = unknown> = OptionsOnly extends true ? SlashCommandOptionsOnlyBuilder<T> : OptionsOnly extends false ? SlashCommandSubcommandsOnlyBuilder<T> : AnySlashCommandBuilder<T> | SlashCommandData<T>;
37
+ /**
38
+ * Message command resolvable
39
+ */
40
+ export declare type MessageCommandResolvable<T = unknown> = MessageCommandBuilder<T> | MessageCommandData<T>;
41
+ /**
42
+ * Message command option resolvable
43
+ */
44
+ export declare type MessageCommandOptionResolvable = MessageCommandOptionBuilder | MessageCommandOptionData;
45
+ /**
46
+ * Slash command options
47
+ */
48
+ export declare type AnySlashCommandOptionData = AnySlashCommandOptionsOnlyOptionData | SlashCommandSubCommandGroupData | SlashCommandSubCommandData;
49
+ /**
50
+ * Slash command options builders
51
+ */
52
+ export declare type AnySlashCommandOptionBuilder = AnySlashCommandOptionsOnlyOptionBuilder | SlashCommandSubcommandGroupBuilder | SlashCommandSubcommandBuilder;
53
+ /**
54
+ * Slash command options without sub commands
55
+ */
56
+ export declare type AnySlashCommandOptionsOnlyOptionData = SlashCommandAttachmentOptionData | SlashCommandBooleanOptionData | SlashCommandChannelOptionData | SlashCommandIntegerOptionData | SlashCommandMentionableOptionData | SlashCommandNumberOptionData | SlashCommandRoleOptionData | SlashCommandStringOptionData | SlashCommandUserOptionData;
57
+ /**
58
+ * Slash command option builder without sub commands
59
+ */
60
+ export declare type AnySlashCommandOptionsOnlyOptionBuilder = SlashCommandAttachmentOption | SlashCommandBooleanOption | SlashCommandChannelOption | SlashCommandIntegerOption | SlashCommandMentionableOption | SlashCommandNumberOption | SlashCommandRoleOption | SlashCommandStringOption | SlashCommandUserOption;
61
+ /**
62
+ * Types of command builders
63
+ */
64
+ export declare enum CommandType {
65
+ SlashCommand = 1,
66
+ MessageCommand = 2
67
+ }
68
+ /**
69
+ * Shared command builder methods and properties
70
+ */
71
+ export interface SharedCommandBuilderProperties<T = unknown> {
72
+ readonly type: CommandType;
73
+ cooldown: number;
74
+ requiredBotPermissions: PermissionResolvable[];
75
+ requiredMemberPermissions: PermissionResolvable[];
76
+ halt?: AnyCommandHaltFunction<T>;
77
+ execute: AnyCommandExecuteFunction<T>;
78
+ metadata?: T;
79
+ /**
80
+ * Sets the execute cooldown for this command.
81
+ * - `0` means no cooldown
82
+ * @param cooldown Command cooldown in milliseconds
83
+ */
84
+ setCooldown(cooldown: number): this;
85
+ /**
86
+ * Set required bot permissions to execute the command
87
+ * @param permissions Bot's required permissions
88
+ */
89
+ setRequiredBotPermissions(...permissions: RestOrArray<PermissionResolvable>): this;
90
+ /**
91
+ * Set required permissions to execute the command
92
+ * @param permissions User's return permissions
93
+ */
94
+ setRequiredMemberPermissions(...permissions: RestOrArray<PermissionResolvable>): this;
95
+ /**
96
+ * Function when the command is interupted
97
+ * @param halt Function to execute when command is halted
98
+ */
99
+ setHalt(halt?: this['halt']): this;
100
+ /**
101
+ * Function when the command is executed
102
+ * @param execute Function to execute when the command is called
103
+ */
104
+ setExecute(execute: this['execute']): this;
105
+ /**
106
+ * Set a command metadata
107
+ * @param metadata Command metadata
108
+ */
109
+ setMetadata(metadata?: T): this;
110
+ }
111
+ /**
112
+ * Shared command name and description properties
113
+ */
114
+ export interface SharedCommandDataProperties {
115
+ name: string;
116
+ description: string;
117
+ }
118
+ /**
119
+ * Slash command object data interface
120
+ */
121
+ export interface SlashCommandData<T = unknown> extends SharedCommandDataProperties, Partial<Omit<SharedCommandBuilderProperties<T>, 'setCooldown' | 'setRequiredBotPermissions' | 'setRequiredMemberPermissions' | 'setHalt' | 'setExecute' | 'setMetadata' | 'halt' | 'execute'>> {
122
+ type: CommandType.SlashCommand;
123
+ nameLocalizations?: LocalizationMap;
124
+ descriptionLocalizations?: LocalizationMap;
125
+ options?: (AnySlashCommandOptionData | AnySlashCommandOptionBuilder)[];
126
+ /**
127
+ * @deprecated This property is deprecated and will be removed in the future.
128
+ */
129
+ defaultPermission?: boolean;
130
+ defaultMemberPermissions?: string | null;
131
+ dmPermission?: boolean;
132
+ halt?: SlashCommandHaltFunction<T>;
133
+ execute: SlashCommandExecuteFunction<T>;
134
+ }
135
+ export interface SharedSlashCommandOptionData<V = string | number> extends SharedCommandDataProperties, Pick<SlashCommandData, 'nameLocalizations' | 'descriptionLocalizations'> {
136
+ choices?: {
137
+ name: string;
138
+ nameLocalizations?: LocalizationMap;
139
+ value: V;
140
+ }[];
141
+ autocomplete?: boolean;
142
+ required?: boolean;
143
+ }
144
+ export interface SlashCommandAttachmentOptionData extends Omit<SharedSlashCommandOptionData, 'choices' | 'autocomplete'> {
145
+ type: ApplicationCommandOptionType.Attachment;
146
+ }
147
+ export interface SlashCommandBooleanOptionData extends Omit<SharedSlashCommandOptionData, 'choices' | 'autocomplete'> {
148
+ type: ApplicationCommandOptionType.Boolean;
149
+ }
150
+ export interface SlashCommandChannelOptionData extends Omit<SharedSlashCommandOptionData, 'choices' | 'autocomplete'> {
151
+ type: ApplicationCommandOptionType.Channel;
152
+ channelTypes?: ApplicationCommandOptionAllowedChannelTypes[];
153
+ }
154
+ export interface SlashCommandIntegerOptionData extends SharedSlashCommandOptionData<number> {
155
+ type: ApplicationCommandOptionType.Integer;
156
+ minValue?: number;
157
+ maxValue?: number;
158
+ }
159
+ export interface SlashCommandMentionableOptionData extends Omit<SharedSlashCommandOptionData, 'choices' | 'autocomplete'> {
160
+ type: ApplicationCommandOptionType.Mentionable;
161
+ }
162
+ export interface SlashCommandNumberOptionData extends SharedSlashCommandOptionData<number> {
163
+ type: ApplicationCommandOptionType.Number;
164
+ minValue?: number;
165
+ maxValue?: number;
166
+ }
167
+ export interface SlashCommandRoleOptionData extends Omit<SharedSlashCommandOptionData, 'choices' | 'autocomplete'> {
168
+ type: ApplicationCommandOptionType.Role;
169
+ }
170
+ export interface SlashCommandStringOptionData extends SharedSlashCommandOptionData<string> {
171
+ type: ApplicationCommandOptionType.String;
172
+ minLength?: number;
173
+ maxLength?: number;
174
+ }
175
+ export interface SlashCommandUserOptionData extends Omit<SharedSlashCommandOptionData, 'choices' | 'autocomplete'> {
176
+ type: ApplicationCommandOptionType.User;
177
+ }
178
+ export interface SlashCommandSubCommandData extends SharedCommandDataProperties, Pick<SlashCommandData, 'nameLocalizations' | 'descriptionLocalizations'> {
179
+ type: ApplicationCommandOptionType.Subcommand;
180
+ options: (AnySlashCommandOptionsOnlyOptionData | AnySlashCommandOptionsOnlyOptionBuilder)[];
181
+ }
182
+ export interface SlashCommandSubCommandGroupData extends SharedCommandDataProperties, Pick<SlashCommandData, 'nameLocalizations' | 'descriptionLocalizations'> {
183
+ type: ApplicationCommandOptionType.SubcommandGroup;
184
+ options: (SlashCommandSubCommandData | SlashCommandSubcommandBuilder)[];
185
+ }
186
+ /**
187
+ * Message command object data interface
188
+ */
189
+ export interface MessageCommandData<T = unknown> extends SharedCommandDataProperties, Partial<Omit<SharedCommandBuilderProperties<T>, 'setCooldown' | 'setRequiredBotPermissions' | 'setRequiredMemberPermissions' | 'setHalt' | 'setExecute' | 'setMetadata' | 'halt' | 'execute'>> {
190
+ type: CommandType.MessageCommand;
191
+ aliases?: string[];
192
+ validateOptions?: boolean;
193
+ allowExecuteInDM?: boolean;
194
+ allowExecuteByBots?: boolean;
195
+ halt?: MessageCommandHaltFunction<T>;
196
+ execute: MessageCommandExecuteFunction<T>;
197
+ options?: MessageCommandOptionResolvable[];
198
+ }
199
+ /**
200
+ * Message command option object data interface
201
+ */
202
+ export interface MessageCommandOptionData extends SharedCommandDataProperties {
203
+ required?: boolean;
204
+ validator?: (value: string) => Awaitable<boolean>;
205
+ }