reciple 6.0.0-dev.17 → 6.0.0-dev.19
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/LICENSE +674 -674
- package/README.md +183 -183
- package/dist/lib/bin.mjs +65 -63
- package/dist/lib/esm.mjs +1 -1
- package/dist/lib/index.js +35 -35
- package/dist/lib/reciple/classes/RecipleClient.js +296 -300
- package/dist/lib/reciple/classes/RecipleConfig.js +106 -106
- package/dist/lib/reciple/classes/RecipleModule.js +94 -94
- package/dist/lib/reciple/classes/builders/MessageCommandBuilder.js +242 -242
- package/dist/lib/reciple/classes/builders/MessageCommandOptionBuilder.js +85 -85
- package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js +216 -216
- package/dist/lib/reciple/classes/managers/ApplicationCommandManager.js +172 -172
- package/dist/lib/reciple/classes/managers/ClientCommandManager.js +62 -62
- package/dist/lib/reciple/classes/managers/ClientModuleManager.js +183 -183
- package/dist/lib/reciple/classes/managers/CommandCooldownManager.js +100 -100
- package/dist/lib/reciple/classes/managers/MessageCommandOptionManager.js +25 -25
- package/dist/lib/reciple/flags.js +31 -31
- package/dist/lib/reciple/permissions.js +30 -30
- package/dist/lib/reciple/types/builders.js +11 -11
- package/dist/lib/reciple/types/commands.js +15 -15
- package/dist/lib/reciple/types/paramOptions.js +2 -2
- package/dist/lib/reciple/util.js +68 -66
- package/dist/lib/reciple/version.js +47 -47
- package/dist/types/bin.d.mts +2 -2
- package/dist/types/esm.d.mts +1 -1
- package/dist/types/index.d.ts +19 -19
- package/dist/types/reciple/classes/RecipleClient.d.ts +103 -103
- package/dist/types/reciple/classes/RecipleConfig.d.ts +100 -100
- package/dist/types/reciple/classes/RecipleModule.d.ts +56 -56
- package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts +150 -150
- package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts +43 -43
- package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts +88 -88
- package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts +51 -51
- package/dist/types/reciple/classes/managers/ClientCommandManager.d.ts +37 -37
- package/dist/types/reciple/classes/managers/ClientModuleManager.d.ts +49 -49
- package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts +70 -70
- package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts +22 -22
- package/dist/types/reciple/flags.d.ts +17 -17
- package/dist/types/reciple/permissions.d.ts +19 -19
- package/dist/types/reciple/types/builders.d.ts +197 -197
- package/dist/types/reciple/types/commands.d.ts +81 -81
- package/dist/types/reciple/types/paramOptions.d.ts +101 -101
- package/dist/types/reciple/util.d.ts +23 -20
- package/dist/types/reciple/version.d.ts +25 -25
- package/package.json +2 -2
- package/resource/reciple.yml +120 -120
|
@@ -1,197 +1,197 @@
|
|
|
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 { 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,81 +1,81 @@
|
|
|
1
|
-
import { MessageCommandExecuteData, MessageCommandHaltData } from '../classes/builders/MessageCommandBuilder';
|
|
2
|
-
import { SlashCommandExecuteData, SlashCommandHaltData } from '../classes/builders/SlashCommandBuilder';
|
|
3
|
-
import { MessageCommandOptionManager } from '../classes/managers/MessageCommandOptionManager';
|
|
4
|
-
import { CooledDownUser } from '../classes/managers/CommandCooldownManager';
|
|
5
|
-
import { RecipleClient } from '../classes/RecipleClient';
|
|
6
|
-
import { CommandType } from '../types/builders';
|
|
7
|
-
/**
|
|
8
|
-
* Any command halt data
|
|
9
|
-
*/
|
|
10
|
-
export declare type AnyCommandHaltData<T = unknown> = SlashCommandHaltData<T> | MessageCommandHaltData<T>;
|
|
11
|
-
/**
|
|
12
|
-
* command halt data
|
|
13
|
-
*/
|
|
14
|
-
export declare type CommandHaltData<T extends CommandType, M = unknown> = CommandErrorHaltData<T, M> | CommandCooldownHaltData<T, M> | (T extends CommandType.SlashCommand ? never : CommandInvalidArgumentsHaltData<T, M> | CommandMissingArgumentsHaltData<T, M>) | CommandMissingMemberPermissionsHaltData<T, M> | CommandMissingBotPermissionsHaltData<T, M>;
|
|
15
|
-
/**
|
|
16
|
-
* Any command execute data
|
|
17
|
-
*/
|
|
18
|
-
export declare type AnyCommandExecuteData<T = unknown> = SlashCommandExecuteData<T> | MessageCommandExecuteData<T>;
|
|
19
|
-
/**
|
|
20
|
-
* Command execute data
|
|
21
|
-
*/
|
|
22
|
-
export interface BaseCommandExecuteData {
|
|
23
|
-
/**
|
|
24
|
-
* Bot client
|
|
25
|
-
*/
|
|
26
|
-
client: RecipleClient<true>;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Command halt reason base
|
|
30
|
-
*/
|
|
31
|
-
export interface BaseCommandHaltData<T extends CommandType, M = unknown> {
|
|
32
|
-
/**
|
|
33
|
-
* Halt reason
|
|
34
|
-
*/
|
|
35
|
-
reason: CommandHaltReason;
|
|
36
|
-
/**
|
|
37
|
-
* Command execute da6a
|
|
38
|
-
*/
|
|
39
|
-
executeData: T extends CommandType.SlashCommand ? SlashCommandExecuteData<M> : T extends CommandType.MessageCommand ? MessageCommandExecuteData<M> : AnyCommandExecuteData<M>;
|
|
40
|
-
}
|
|
41
|
-
export interface CommandErrorHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
|
|
42
|
-
reason: CommandHaltReason.Error;
|
|
43
|
-
/**
|
|
44
|
-
* Caught error
|
|
45
|
-
*/
|
|
46
|
-
error: any;
|
|
47
|
-
}
|
|
48
|
-
export interface CommandCooldownHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M>, CooledDownUser {
|
|
49
|
-
reason: CommandHaltReason.Cooldown;
|
|
50
|
-
}
|
|
51
|
-
export interface CommandInvalidArgumentsHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
|
|
52
|
-
reason: CommandHaltReason.InvalidArguments;
|
|
53
|
-
/**
|
|
54
|
-
* Arguments that are invalid
|
|
55
|
-
*/
|
|
56
|
-
invalidArguments: MessageCommandOptionManager;
|
|
57
|
-
}
|
|
58
|
-
export interface CommandMissingArgumentsHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
|
|
59
|
-
reason: CommandHaltReason.MissingArguments;
|
|
60
|
-
/**
|
|
61
|
-
* Arguments that are missing
|
|
62
|
-
*/
|
|
63
|
-
missingArguments: MessageCommandOptionManager;
|
|
64
|
-
}
|
|
65
|
-
export interface CommandMissingMemberPermissionsHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
|
|
66
|
-
reason: CommandHaltReason.MissingMemberPermissions;
|
|
67
|
-
}
|
|
68
|
-
export interface CommandMissingBotPermissionsHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
|
|
69
|
-
reason: CommandHaltReason.MissingBotPermissions;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Command halt reasons
|
|
73
|
-
*/
|
|
74
|
-
export declare enum CommandHaltReason {
|
|
75
|
-
Error = 1,
|
|
76
|
-
Cooldown = 2,
|
|
77
|
-
InvalidArguments = 3,
|
|
78
|
-
MissingArguments = 4,
|
|
79
|
-
MissingMemberPermissions = 5,
|
|
80
|
-
MissingBotPermissions = 6
|
|
81
|
-
}
|
|
1
|
+
import { MessageCommandExecuteData, MessageCommandHaltData } from '../classes/builders/MessageCommandBuilder';
|
|
2
|
+
import { SlashCommandExecuteData, SlashCommandHaltData } from '../classes/builders/SlashCommandBuilder';
|
|
3
|
+
import { MessageCommandOptionManager } from '../classes/managers/MessageCommandOptionManager';
|
|
4
|
+
import { CooledDownUser } from '../classes/managers/CommandCooldownManager';
|
|
5
|
+
import { RecipleClient } from '../classes/RecipleClient';
|
|
6
|
+
import { CommandType } from '../types/builders';
|
|
7
|
+
/**
|
|
8
|
+
* Any command halt data
|
|
9
|
+
*/
|
|
10
|
+
export declare type AnyCommandHaltData<T = unknown> = SlashCommandHaltData<T> | MessageCommandHaltData<T>;
|
|
11
|
+
/**
|
|
12
|
+
* command halt data
|
|
13
|
+
*/
|
|
14
|
+
export declare type CommandHaltData<T extends CommandType, M = unknown> = CommandErrorHaltData<T, M> | CommandCooldownHaltData<T, M> | (T extends CommandType.SlashCommand ? never : CommandInvalidArgumentsHaltData<T, M> | CommandMissingArgumentsHaltData<T, M>) | CommandMissingMemberPermissionsHaltData<T, M> | CommandMissingBotPermissionsHaltData<T, M>;
|
|
15
|
+
/**
|
|
16
|
+
* Any command execute data
|
|
17
|
+
*/
|
|
18
|
+
export declare type AnyCommandExecuteData<T = unknown> = SlashCommandExecuteData<T> | MessageCommandExecuteData<T>;
|
|
19
|
+
/**
|
|
20
|
+
* Command execute data
|
|
21
|
+
*/
|
|
22
|
+
export interface BaseCommandExecuteData {
|
|
23
|
+
/**
|
|
24
|
+
* Bot client
|
|
25
|
+
*/
|
|
26
|
+
client: RecipleClient<true>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Command halt reason base
|
|
30
|
+
*/
|
|
31
|
+
export interface BaseCommandHaltData<T extends CommandType, M = unknown> {
|
|
32
|
+
/**
|
|
33
|
+
* Halt reason
|
|
34
|
+
*/
|
|
35
|
+
reason: CommandHaltReason;
|
|
36
|
+
/**
|
|
37
|
+
* Command execute da6a
|
|
38
|
+
*/
|
|
39
|
+
executeData: T extends CommandType.SlashCommand ? SlashCommandExecuteData<M> : T extends CommandType.MessageCommand ? MessageCommandExecuteData<M> : AnyCommandExecuteData<M>;
|
|
40
|
+
}
|
|
41
|
+
export interface CommandErrorHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
|
|
42
|
+
reason: CommandHaltReason.Error;
|
|
43
|
+
/**
|
|
44
|
+
* Caught error
|
|
45
|
+
*/
|
|
46
|
+
error: any;
|
|
47
|
+
}
|
|
48
|
+
export interface CommandCooldownHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M>, CooledDownUser {
|
|
49
|
+
reason: CommandHaltReason.Cooldown;
|
|
50
|
+
}
|
|
51
|
+
export interface CommandInvalidArgumentsHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
|
|
52
|
+
reason: CommandHaltReason.InvalidArguments;
|
|
53
|
+
/**
|
|
54
|
+
* Arguments that are invalid
|
|
55
|
+
*/
|
|
56
|
+
invalidArguments: MessageCommandOptionManager;
|
|
57
|
+
}
|
|
58
|
+
export interface CommandMissingArgumentsHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
|
|
59
|
+
reason: CommandHaltReason.MissingArguments;
|
|
60
|
+
/**
|
|
61
|
+
* Arguments that are missing
|
|
62
|
+
*/
|
|
63
|
+
missingArguments: MessageCommandOptionManager;
|
|
64
|
+
}
|
|
65
|
+
export interface CommandMissingMemberPermissionsHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
|
|
66
|
+
reason: CommandHaltReason.MissingMemberPermissions;
|
|
67
|
+
}
|
|
68
|
+
export interface CommandMissingBotPermissionsHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
|
|
69
|
+
reason: CommandHaltReason.MissingBotPermissions;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Command halt reasons
|
|
73
|
+
*/
|
|
74
|
+
export declare enum CommandHaltReason {
|
|
75
|
+
Error = 1,
|
|
76
|
+
Cooldown = 2,
|
|
77
|
+
InvalidArguments = 3,
|
|
78
|
+
MissingArguments = 4,
|
|
79
|
+
MissingMemberPermissions = 5,
|
|
80
|
+
MissingBotPermissions = 6
|
|
81
|
+
}
|