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.
- package/LICENSE +674 -674
- package/README.md +183 -183
- package/dist/lib/bin.mjs +66 -65
- package/dist/lib/esm.mjs +1 -1
- package/dist/lib/index.js +33 -35
- package/dist/lib/reciple/classes/RecipleClient.js +296 -296
- 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 +309 -325
- package/dist/lib/reciple/classes/builders/MessageCommandOptionBuilder.js +126 -107
- package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js +246 -246
- package/dist/lib/reciple/classes/managers/ApplicationCommandManager.js +178 -178
- package/dist/lib/reciple/classes/managers/CommandCooldownManager.js +99 -100
- package/dist/lib/reciple/classes/managers/CommandManager.js +59 -59
- package/dist/lib/reciple/classes/managers/MessageCommandOptionManager.js +25 -25
- package/dist/lib/reciple/classes/managers/ModuleManager.js +176 -179
- 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 +69 -68
- 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 +17 -19
- package/dist/types/reciple/classes/RecipleClient.d.ts +104 -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 +189 -184
- package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts +53 -51
- package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts +98 -98
- package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts +53 -53
- package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts +70 -70
- package/dist/types/reciple/classes/managers/CommandManager.d.ts +34 -36
- package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts +22 -22
- package/dist/types/reciple/classes/managers/ModuleManager.d.ts +49 -49
- package/dist/types/reciple/flags.d.ts +17 -17
- package/dist/types/reciple/permissions.d.ts +15 -19
- package/dist/types/reciple/types/builders.d.ts +205 -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 +26 -23
- package/dist/types/reciple/version.d.ts +25 -25
- package/package.json +21 -20
- package/resource/reciple.yml +120 -120
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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
|
|
11
|
-
* @param requiredPermissions Required guild bot permissions
|
|
12
|
-
*/
|
|
13
|
-
export declare function botHasExecutePermissions(
|
|
14
|
-
|
|
15
|
-
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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
|
-
*
|
|
35
|
-
*/
|
|
36
|
-
export declare type
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
*/
|
|
40
|
-
export declare type
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
|
-
export declare type
|
|
45
|
-
/**
|
|
46
|
-
* Slash command options
|
|
47
|
-
*/
|
|
48
|
-
export declare type
|
|
49
|
-
/**
|
|
50
|
-
* Slash command
|
|
51
|
-
*/
|
|
52
|
-
export declare type
|
|
53
|
-
/**
|
|
54
|
-
*
|
|
55
|
-
*/
|
|
56
|
-
export declare
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
export interface
|
|
155
|
-
type: ApplicationCommandOptionType.
|
|
156
|
-
minValue?: number;
|
|
157
|
-
maxValue?: number;
|
|
158
|
-
}
|
|
159
|
-
export interface
|
|
160
|
-
type: ApplicationCommandOptionType.
|
|
161
|
-
}
|
|
162
|
-
export interface
|
|
163
|
-
type: ApplicationCommandOptionType.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
export interface
|
|
168
|
-
type: ApplicationCommandOptionType.
|
|
169
|
-
}
|
|
170
|
-
export interface
|
|
171
|
-
type: ApplicationCommandOptionType.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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
|
+
}
|