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,150 +1,150 @@
|
|
|
1
|
-
import { CommandType, CommandHaltFunction, CommandExecuteFunction, SharedCommandBuilderProperties, MessageCommandData } from '../../types/builders';
|
|
2
|
-
import { Message, PermissionResolvable, RestOrArray } from 'discord.js';
|
|
3
|
-
import { BaseCommandExecuteData, CommandHaltData } from '../../types/commands';
|
|
4
|
-
import { MessageCommandOptionManager } from '../managers/MessageCommandOptionManager';
|
|
5
|
-
import { MessageCommandOptionBuilder } from './MessageCommandOptionBuilder';
|
|
6
|
-
import { Command } from 'fallout-utility';
|
|
7
|
-
/**
|
|
8
|
-
* Execute data for message command
|
|
9
|
-
*/
|
|
10
|
-
export interface MessageCommandExecuteData<T = unknown> extends BaseCommandExecuteData {
|
|
11
|
-
/**
|
|
12
|
-
* Command message
|
|
13
|
-
*/
|
|
14
|
-
message: Message;
|
|
15
|
-
/**
|
|
16
|
-
* Command option args
|
|
17
|
-
*/
|
|
18
|
-
options: MessageCommandOptionManager;
|
|
19
|
-
/**
|
|
20
|
-
* Command parsed args
|
|
21
|
-
*/
|
|
22
|
-
command: Command;
|
|
23
|
-
/**
|
|
24
|
-
* Command builder
|
|
25
|
-
*/
|
|
26
|
-
builder: MessageCommandBuilder<T>;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Validated message command option
|
|
30
|
-
*/
|
|
31
|
-
export interface MessageCommandValidatedOption {
|
|
32
|
-
/**
|
|
33
|
-
* Option name
|
|
34
|
-
*/
|
|
35
|
-
name: string;
|
|
36
|
-
/**
|
|
37
|
-
* Option value
|
|
38
|
-
*/
|
|
39
|
-
value?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Is the option required
|
|
42
|
-
*/
|
|
43
|
-
required: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Is the option invalid
|
|
46
|
-
*/
|
|
47
|
-
invalid: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Is the option missing
|
|
50
|
-
*/
|
|
51
|
-
missing: boolean;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Halt data for message command
|
|
55
|
-
*/
|
|
56
|
-
export declare type MessageCommandHaltData<T = unknown> = CommandHaltData<CommandType.MessageCommand, T>;
|
|
57
|
-
/**
|
|
58
|
-
* Message command halt function
|
|
59
|
-
*/
|
|
60
|
-
export declare type MessageCommandHaltFunction<T = unknown> = CommandHaltFunction<CommandType.MessageCommand, T>;
|
|
61
|
-
/**
|
|
62
|
-
* Message command execute function
|
|
63
|
-
*/
|
|
64
|
-
export declare type MessageCommandExecuteFunction<T = unknown> = CommandExecuteFunction<CommandType.MessageCommand, T>;
|
|
65
|
-
/**
|
|
66
|
-
* Reciple builder for message command
|
|
67
|
-
*/
|
|
68
|
-
export declare class MessageCommandBuilder<T = unknown> implements SharedCommandBuilderProperties<T> {
|
|
69
|
-
readonly type = CommandType.MessageCommand;
|
|
70
|
-
name: string;
|
|
71
|
-
description: string;
|
|
72
|
-
cooldown: number;
|
|
73
|
-
aliases: string[];
|
|
74
|
-
validateOptions: boolean;
|
|
75
|
-
options: MessageCommandOptionBuilder[];
|
|
76
|
-
requiredBotPermissions: PermissionResolvable[];
|
|
77
|
-
requiredMemberPermissions: PermissionResolvable[];
|
|
78
|
-
allowExecuteInDM: boolean;
|
|
79
|
-
allowExecuteByBots: boolean;
|
|
80
|
-
halt?: MessageCommandHaltFunction<T>;
|
|
81
|
-
execute: MessageCommandExecuteFunction<T>;
|
|
82
|
-
metadata?: T;
|
|
83
|
-
constructor(data?: Partial<Omit<MessageCommandData<T>, 'type'>>);
|
|
84
|
-
/**
|
|
85
|
-
* Sets the command name
|
|
86
|
-
* @param name Command name
|
|
87
|
-
*/
|
|
88
|
-
setName(name: string): this;
|
|
89
|
-
/**
|
|
90
|
-
* Sets the command description
|
|
91
|
-
* @param description Command description
|
|
92
|
-
*/
|
|
93
|
-
setDescription(description: string): this;
|
|
94
|
-
/**
|
|
95
|
-
* Add aliases to the command
|
|
96
|
-
* @param aliases Command aliases
|
|
97
|
-
*/
|
|
98
|
-
addAliases(...aliases: RestOrArray<string>): this;
|
|
99
|
-
/**
|
|
100
|
-
* Set if command can be executed in dms
|
|
101
|
-
* @param allowExecuteInDM `true` if the command can execute in DMs
|
|
102
|
-
*/
|
|
103
|
-
setAllowExecuteInDM(allowExecuteInDM: boolean): this;
|
|
104
|
-
/**
|
|
105
|
-
* Allow command to be executed by bots
|
|
106
|
-
* @param allowExecuteByBots `true` if the command can be executed by bots
|
|
107
|
-
*/
|
|
108
|
-
setAllowExecuteByBots(allowExecuteByBots: boolean): this;
|
|
109
|
-
/**
|
|
110
|
-
* Add option to the command
|
|
111
|
-
* @param option Message option builder
|
|
112
|
-
*/
|
|
113
|
-
addOption(option: MessageCommandOptionBuilder | ((constructor: MessageCommandOptionBuilder) => MessageCommandOptionBuilder)): this;
|
|
114
|
-
/**
|
|
115
|
-
* Validate options before executing
|
|
116
|
-
* @param validateOptions `true` if the command options needs to be validated before executing
|
|
117
|
-
*/
|
|
118
|
-
setValidateOptions(validateOptions: boolean): this;
|
|
119
|
-
setCooldown(cooldown: number): this;
|
|
120
|
-
setRequiredBotPermissions(...permissions: RestOrArray<PermissionResolvable>): this;
|
|
121
|
-
setRequiredMemberPermissions(...permissions: RestOrArray<PermissionResolvable>): this;
|
|
122
|
-
setHalt(halt?: MessageCommandHaltFunction<T> | null): this;
|
|
123
|
-
setExecute(execute: MessageCommandExecuteFunction<T>): this;
|
|
124
|
-
setMetadata(metadata?: T): this;
|
|
125
|
-
/**
|
|
126
|
-
* Returns JSON object of this builder
|
|
127
|
-
*/
|
|
128
|
-
toJSON(): MessageCommandData<T>;
|
|
129
|
-
/**
|
|
130
|
-
* Resolve message command data/builder
|
|
131
|
-
* @param commandData Command data to resolve
|
|
132
|
-
*/
|
|
133
|
-
static resolveMessageCommand<T = unknown>(commandData: MessageCommandData<T> | MessageCommandBuilder<T>): MessageCommandBuilder<T>;
|
|
134
|
-
/**
|
|
135
|
-
* Is a message command builder
|
|
136
|
-
* @param builder data to check
|
|
137
|
-
*/
|
|
138
|
-
static isMessageCommandBuilder<T>(builder: unknown): builder is MessageCommandBuilder<T>;
|
|
139
|
-
/**
|
|
140
|
-
* Is a message command execute data
|
|
141
|
-
* @param executeData data to check
|
|
142
|
-
*/
|
|
143
|
-
static isMessageCommandExecuteData(executeData: unknown): executeData is MessageCommandExecuteData;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Validate message command options
|
|
147
|
-
* @param builder Command builder
|
|
148
|
-
* @param options Parsed command args
|
|
149
|
-
*/
|
|
150
|
-
export declare function validateMessageCommandOptions(builder: MessageCommandBuilder, options: Command): Promise<MessageCommandOptionManager>;
|
|
1
|
+
import { CommandType, CommandHaltFunction, CommandExecuteFunction, SharedCommandBuilderProperties, MessageCommandData } from '../../types/builders';
|
|
2
|
+
import { Message, PermissionResolvable, RestOrArray } from 'discord.js';
|
|
3
|
+
import { BaseCommandExecuteData, CommandHaltData } from '../../types/commands';
|
|
4
|
+
import { MessageCommandOptionManager } from '../managers/MessageCommandOptionManager';
|
|
5
|
+
import { MessageCommandOptionBuilder } from './MessageCommandOptionBuilder';
|
|
6
|
+
import { Command } from 'fallout-utility';
|
|
7
|
+
/**
|
|
8
|
+
* Execute data for message command
|
|
9
|
+
*/
|
|
10
|
+
export interface MessageCommandExecuteData<T = unknown> extends BaseCommandExecuteData {
|
|
11
|
+
/**
|
|
12
|
+
* Command message
|
|
13
|
+
*/
|
|
14
|
+
message: Message;
|
|
15
|
+
/**
|
|
16
|
+
* Command option args
|
|
17
|
+
*/
|
|
18
|
+
options: MessageCommandOptionManager;
|
|
19
|
+
/**
|
|
20
|
+
* Command parsed args
|
|
21
|
+
*/
|
|
22
|
+
command: Command;
|
|
23
|
+
/**
|
|
24
|
+
* Command builder
|
|
25
|
+
*/
|
|
26
|
+
builder: MessageCommandBuilder<T>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Validated message command option
|
|
30
|
+
*/
|
|
31
|
+
export interface MessageCommandValidatedOption {
|
|
32
|
+
/**
|
|
33
|
+
* Option name
|
|
34
|
+
*/
|
|
35
|
+
name: string;
|
|
36
|
+
/**
|
|
37
|
+
* Option value
|
|
38
|
+
*/
|
|
39
|
+
value?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Is the option required
|
|
42
|
+
*/
|
|
43
|
+
required: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Is the option invalid
|
|
46
|
+
*/
|
|
47
|
+
invalid: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Is the option missing
|
|
50
|
+
*/
|
|
51
|
+
missing: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Halt data for message command
|
|
55
|
+
*/
|
|
56
|
+
export declare type MessageCommandHaltData<T = unknown> = CommandHaltData<CommandType.MessageCommand, T>;
|
|
57
|
+
/**
|
|
58
|
+
* Message command halt function
|
|
59
|
+
*/
|
|
60
|
+
export declare type MessageCommandHaltFunction<T = unknown> = CommandHaltFunction<CommandType.MessageCommand, T>;
|
|
61
|
+
/**
|
|
62
|
+
* Message command execute function
|
|
63
|
+
*/
|
|
64
|
+
export declare type MessageCommandExecuteFunction<T = unknown> = CommandExecuteFunction<CommandType.MessageCommand, T>;
|
|
65
|
+
/**
|
|
66
|
+
* Reciple builder for message command
|
|
67
|
+
*/
|
|
68
|
+
export declare class MessageCommandBuilder<T = unknown> implements SharedCommandBuilderProperties<T> {
|
|
69
|
+
readonly type = CommandType.MessageCommand;
|
|
70
|
+
name: string;
|
|
71
|
+
description: string;
|
|
72
|
+
cooldown: number;
|
|
73
|
+
aliases: string[];
|
|
74
|
+
validateOptions: boolean;
|
|
75
|
+
options: MessageCommandOptionBuilder[];
|
|
76
|
+
requiredBotPermissions: PermissionResolvable[];
|
|
77
|
+
requiredMemberPermissions: PermissionResolvable[];
|
|
78
|
+
allowExecuteInDM: boolean;
|
|
79
|
+
allowExecuteByBots: boolean;
|
|
80
|
+
halt?: MessageCommandHaltFunction<T>;
|
|
81
|
+
execute: MessageCommandExecuteFunction<T>;
|
|
82
|
+
metadata?: T;
|
|
83
|
+
constructor(data?: Partial<Omit<MessageCommandData<T>, 'type'>>);
|
|
84
|
+
/**
|
|
85
|
+
* Sets the command name
|
|
86
|
+
* @param name Command name
|
|
87
|
+
*/
|
|
88
|
+
setName(name: string): this;
|
|
89
|
+
/**
|
|
90
|
+
* Sets the command description
|
|
91
|
+
* @param description Command description
|
|
92
|
+
*/
|
|
93
|
+
setDescription(description: string): this;
|
|
94
|
+
/**
|
|
95
|
+
* Add aliases to the command
|
|
96
|
+
* @param aliases Command aliases
|
|
97
|
+
*/
|
|
98
|
+
addAliases(...aliases: RestOrArray<string>): this;
|
|
99
|
+
/**
|
|
100
|
+
* Set if command can be executed in dms
|
|
101
|
+
* @param allowExecuteInDM `true` if the command can execute in DMs
|
|
102
|
+
*/
|
|
103
|
+
setAllowExecuteInDM(allowExecuteInDM: boolean): this;
|
|
104
|
+
/**
|
|
105
|
+
* Allow command to be executed by bots
|
|
106
|
+
* @param allowExecuteByBots `true` if the command can be executed by bots
|
|
107
|
+
*/
|
|
108
|
+
setAllowExecuteByBots(allowExecuteByBots: boolean): this;
|
|
109
|
+
/**
|
|
110
|
+
* Add option to the command
|
|
111
|
+
* @param option Message option builder
|
|
112
|
+
*/
|
|
113
|
+
addOption(option: MessageCommandOptionBuilder | ((constructor: MessageCommandOptionBuilder) => MessageCommandOptionBuilder)): this;
|
|
114
|
+
/**
|
|
115
|
+
* Validate options before executing
|
|
116
|
+
* @param validateOptions `true` if the command options needs to be validated before executing
|
|
117
|
+
*/
|
|
118
|
+
setValidateOptions(validateOptions: boolean): this;
|
|
119
|
+
setCooldown(cooldown: number): this;
|
|
120
|
+
setRequiredBotPermissions(...permissions: RestOrArray<PermissionResolvable>): this;
|
|
121
|
+
setRequiredMemberPermissions(...permissions: RestOrArray<PermissionResolvable>): this;
|
|
122
|
+
setHalt(halt?: MessageCommandHaltFunction<T> | null): this;
|
|
123
|
+
setExecute(execute: MessageCommandExecuteFunction<T>): this;
|
|
124
|
+
setMetadata(metadata?: T): this;
|
|
125
|
+
/**
|
|
126
|
+
* Returns JSON object of this builder
|
|
127
|
+
*/
|
|
128
|
+
toJSON(): MessageCommandData<T>;
|
|
129
|
+
/**
|
|
130
|
+
* Resolve message command data/builder
|
|
131
|
+
* @param commandData Command data to resolve
|
|
132
|
+
*/
|
|
133
|
+
static resolveMessageCommand<T = unknown>(commandData: MessageCommandData<T> | MessageCommandBuilder<T>): MessageCommandBuilder<T>;
|
|
134
|
+
/**
|
|
135
|
+
* Is a message command builder
|
|
136
|
+
* @param builder data to check
|
|
137
|
+
*/
|
|
138
|
+
static isMessageCommandBuilder<T>(builder: unknown): builder is MessageCommandBuilder<T>;
|
|
139
|
+
/**
|
|
140
|
+
* Is a message command execute data
|
|
141
|
+
* @param executeData data to check
|
|
142
|
+
*/
|
|
143
|
+
static isMessageCommandExecuteData(executeData: unknown): executeData is MessageCommandExecuteData;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Validate message command options
|
|
147
|
+
* @param builder Command builder
|
|
148
|
+
* @param options Parsed command args
|
|
149
|
+
*/
|
|
150
|
+
export declare function validateMessageCommandOptions(builder: MessageCommandBuilder, options: Command): Promise<MessageCommandOptionManager>;
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { MessageCommandOptionData } from '../../types/builders';
|
|
2
|
-
import { Awaitable } from 'discord.js';
|
|
3
|
-
/**
|
|
4
|
-
* Option builder for MessageCommandBuilder
|
|
5
|
-
*/
|
|
6
|
-
export declare class MessageCommandOptionBuilder {
|
|
7
|
-
name: string;
|
|
8
|
-
description: string;
|
|
9
|
-
required: boolean;
|
|
10
|
-
validator: (value: string) => Awaitable<boolean>;
|
|
11
|
-
constructor(data?: Partial<MessageCommandOptionData>);
|
|
12
|
-
/**
|
|
13
|
-
* Set command option name
|
|
14
|
-
* @param name Option name
|
|
15
|
-
*/
|
|
16
|
-
setName(name: string): this;
|
|
17
|
-
/**
|
|
18
|
-
* Set command option description
|
|
19
|
-
* @param description Option description
|
|
20
|
-
*/
|
|
21
|
-
setDescription(description: string): this;
|
|
22
|
-
/**
|
|
23
|
-
* Set if this option is required
|
|
24
|
-
* @param required `true` if this option is required
|
|
25
|
-
*/
|
|
26
|
-
setRequired(required: boolean): this;
|
|
27
|
-
/**
|
|
28
|
-
* Set your custom function to validate given value for this option
|
|
29
|
-
* @param validator Custom function to validate value given for this option
|
|
30
|
-
*/
|
|
31
|
-
setValidator(validator: (value: string) => Awaitable<boolean>): this;
|
|
32
|
-
toJSON(): MessageCommandOptionData;
|
|
33
|
-
/**
|
|
34
|
-
* Resolves message command option data/builder
|
|
35
|
-
* @param option Option data to resolve
|
|
36
|
-
*/
|
|
37
|
-
static resolveMessageCommandOption(option: MessageCommandOptionBuilder | MessageCommandOptionBuilder): MessageCommandOptionBuilder;
|
|
38
|
-
/**
|
|
39
|
-
* Is a Message command option builder
|
|
40
|
-
* @param builder data to check
|
|
41
|
-
*/
|
|
42
|
-
static isMessageCommandOption(builder: unknown): builder is MessageCommandOptionBuilder;
|
|
43
|
-
}
|
|
1
|
+
import { MessageCommandOptionData } from '../../types/builders';
|
|
2
|
+
import { Awaitable } from 'discord.js';
|
|
3
|
+
/**
|
|
4
|
+
* Option builder for MessageCommandBuilder
|
|
5
|
+
*/
|
|
6
|
+
export declare class MessageCommandOptionBuilder {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
required: boolean;
|
|
10
|
+
validator: (value: string) => Awaitable<boolean>;
|
|
11
|
+
constructor(data?: Partial<MessageCommandOptionData>);
|
|
12
|
+
/**
|
|
13
|
+
* Set command option name
|
|
14
|
+
* @param name Option name
|
|
15
|
+
*/
|
|
16
|
+
setName(name: string): this;
|
|
17
|
+
/**
|
|
18
|
+
* Set command option description
|
|
19
|
+
* @param description Option description
|
|
20
|
+
*/
|
|
21
|
+
setDescription(description: string): this;
|
|
22
|
+
/**
|
|
23
|
+
* Set if this option is required
|
|
24
|
+
* @param required `true` if this option is required
|
|
25
|
+
*/
|
|
26
|
+
setRequired(required: boolean): this;
|
|
27
|
+
/**
|
|
28
|
+
* Set your custom function to validate given value for this option
|
|
29
|
+
* @param validator Custom function to validate value given for this option
|
|
30
|
+
*/
|
|
31
|
+
setValidator(validator: (value: string) => Awaitable<boolean>): this;
|
|
32
|
+
toJSON(): MessageCommandOptionData;
|
|
33
|
+
/**
|
|
34
|
+
* Resolves message command option data/builder
|
|
35
|
+
* @param option Option data to resolve
|
|
36
|
+
*/
|
|
37
|
+
static resolveMessageCommandOption(option: MessageCommandOptionBuilder | MessageCommandOptionBuilder): MessageCommandOptionBuilder;
|
|
38
|
+
/**
|
|
39
|
+
* Is a Message command option builder
|
|
40
|
+
* @param builder data to check
|
|
41
|
+
*/
|
|
42
|
+
static isMessageCommandOption(builder: unknown): builder is MessageCommandOptionBuilder;
|
|
43
|
+
}
|
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
import { CommandType, CommandHaltFunction, CommandExecuteFunction, SharedCommandBuilderProperties, AnySlashCommandBuilder, SlashCommandData, AnySlashCommandOptionData, AnySlashCommandOptionBuilder } from '../../types/builders';
|
|
2
|
-
import { BaseCommandExecuteData, CommandHaltData } from '../../types/commands';
|
|
3
|
-
import { ChatInputCommandInteraction, PermissionResolvable, RestOrArray, SlashCommandBuilder as DiscordJsSlashCommandBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandBooleanOption, SlashCommandUserOption, SlashCommandChannelOption, SlashCommandRoleOption, SlashCommandAttachmentOption, SlashCommandMentionableOption, SlashCommandStringOption, SlashCommandIntegerOption, SlashCommandNumberOption, SharedSlashCommandOptions } from 'discord.js';
|
|
4
|
-
/**
|
|
5
|
-
* Execute data for slash command
|
|
6
|
-
*/
|
|
7
|
-
export interface SlashCommandExecuteData<T = unknown> extends BaseCommandExecuteData {
|
|
8
|
-
/**
|
|
9
|
-
* Command interaction
|
|
10
|
-
*/
|
|
11
|
-
interaction: ChatInputCommandInteraction;
|
|
12
|
-
/**
|
|
13
|
-
* Command Builder
|
|
14
|
-
*/
|
|
15
|
-
builder: AnySlashCommandBuilder<T>;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Slash command halt data
|
|
19
|
-
*/
|
|
20
|
-
export declare type SlashCommandHaltData<T = unknown> = CommandHaltData<CommandType.SlashCommand, T>;
|
|
21
|
-
/**
|
|
22
|
-
* Slash command halt function
|
|
23
|
-
*/
|
|
24
|
-
export declare type SlashCommandHaltFunction<T = unknown> = CommandHaltFunction<CommandType.SlashCommand, T>;
|
|
25
|
-
/**
|
|
26
|
-
* Slash command execute function
|
|
27
|
-
*/
|
|
28
|
-
export declare type SlashCommandExecuteFunction<T = unknown> = CommandExecuteFunction<CommandType.SlashCommand, T>;
|
|
29
|
-
export declare type SlashCommandSubcommandsOnlyBuilder<T = unknown> = Omit<SlashCommandBuilder<T>, 'addBooleanOption' | 'addUserOption' | 'addChannelOption' | 'addRoleOption' | 'addAttachmentOption' | 'addMentionableOption' | 'addStringOption' | 'addIntegerOption' | 'addNumberOption'>;
|
|
30
|
-
export declare type SlashCommandOptionsOnlyBuilder<T = unknown> = Omit<SlashCommandBuilder<T>, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
31
|
-
export interface SlashCommandBuilder<T = unknown> extends DiscordJsSlashCommandBuilder {
|
|
32
|
-
addSubcommandGroup(input: SlashCommandSubcommandGroupBuilder | ((subcommandGroup: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder)): SlashCommandSubcommandsOnlyBuilder;
|
|
33
|
-
addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): SlashCommandSubcommandsOnlyBuilder;
|
|
34
|
-
addBooleanOption(input: SlashCommandBooleanOption | ((builder: SlashCommandBooleanOption) => SlashCommandBooleanOption)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
35
|
-
addUserOption(input: SlashCommandUserOption | ((builder: SlashCommandUserOption) => SlashCommandUserOption)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
36
|
-
addChannelOption(input: SlashCommandChannelOption | ((builder: SlashCommandChannelOption) => SlashCommandChannelOption)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
37
|
-
addRoleOption(input: SlashCommandRoleOption | ((builder: SlashCommandRoleOption) => SlashCommandRoleOption)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
38
|
-
addAttachmentOption(input: SlashCommandAttachmentOption | ((builder: SlashCommandAttachmentOption) => SlashCommandAttachmentOption)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
39
|
-
addMentionableOption(input: SlashCommandMentionableOption | ((builder: SlashCommandMentionableOption) => SlashCommandMentionableOption)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
40
|
-
addStringOption(input: SlashCommandStringOption | Omit<SlashCommandStringOption, 'setAutocomplete'> | Omit<SlashCommandStringOption, 'addChoices'> | ((builder: SlashCommandStringOption) => SlashCommandStringOption | Omit<SlashCommandStringOption, 'setAutocomplete'> | Omit<SlashCommandStringOption, 'addChoices'>)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
41
|
-
addIntegerOption(input: SlashCommandIntegerOption | Omit<SlashCommandIntegerOption, 'setAutocomplete'> | Omit<SlashCommandIntegerOption, 'addChoices'> | ((builder: SlashCommandIntegerOption) => SlashCommandIntegerOption | Omit<SlashCommandIntegerOption, 'setAutocomplete'> | Omit<SlashCommandIntegerOption, 'addChoices'>)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
42
|
-
addNumberOption(input: SlashCommandNumberOption | Omit<SlashCommandNumberOption, 'setAutocomplete'> | Omit<SlashCommandNumberOption, 'addChoices'> | ((builder: SlashCommandNumberOption) => SlashCommandNumberOption | Omit<SlashCommandNumberOption, 'setAutocomplete'> | Omit<SlashCommandNumberOption, 'addChoices'>)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Reciple builder for slash command
|
|
46
|
-
*/
|
|
47
|
-
export declare class SlashCommandBuilder<T = unknown> extends DiscordJsSlashCommandBuilder implements SharedCommandBuilderProperties<T> {
|
|
48
|
-
readonly type = CommandType.SlashCommand;
|
|
49
|
-
cooldown: number;
|
|
50
|
-
requiredBotPermissions: PermissionResolvable[];
|
|
51
|
-
requiredMemberPermissions: PermissionResolvable[];
|
|
52
|
-
halt?: SlashCommandHaltFunction<T>;
|
|
53
|
-
execute: SlashCommandExecuteFunction<T>;
|
|
54
|
-
metadata?: T;
|
|
55
|
-
constructor(data?: Partial<Omit<SlashCommandData<T>, 'type'>>);
|
|
56
|
-
setCooldown(cooldown: number): this;
|
|
57
|
-
setRequiredBotPermissions(...permissions: RestOrArray<PermissionResolvable>): this;
|
|
58
|
-
setRequiredMemberPermissions(...permissions: RestOrArray<PermissionResolvable>): this;
|
|
59
|
-
setHalt(halt?: SlashCommandHaltFunction<T> | null): this;
|
|
60
|
-
setExecute(execute: SlashCommandExecuteFunction<T>): this;
|
|
61
|
-
setMetadata(metadata?: T): this;
|
|
62
|
-
/**
|
|
63
|
-
* Add option builder to command builder
|
|
64
|
-
* @param builder Command/Subcommand builder
|
|
65
|
-
* @param option Option builder
|
|
66
|
-
*/
|
|
67
|
-
static addOption(builder: SharedSlashCommandOptions | SlashCommandBuilder, option: AnySlashCommandOptionBuilder): SharedSlashCommandOptions;
|
|
68
|
-
/**
|
|
69
|
-
* Resolve option data
|
|
70
|
-
* @param option Option dara to resolve
|
|
71
|
-
*/
|
|
72
|
-
static resolveOption<T extends AnySlashCommandOptionBuilder>(option: AnySlashCommandOptionData): T;
|
|
73
|
-
/**
|
|
74
|
-
* Resolve slash command data/builder
|
|
75
|
-
* @param commandData Command data to resolve
|
|
76
|
-
*/
|
|
77
|
-
static resolveSlashCommand<T = unknown>(commandData: SlashCommandData<T> | AnySlashCommandBuilder<T>): AnySlashCommandBuilder<T>;
|
|
78
|
-
/**
|
|
79
|
-
* Is a slash command builder
|
|
80
|
-
* @param builder data to check
|
|
81
|
-
*/
|
|
82
|
-
static isSlashCommandBuilder<T = unknown>(builder: unknown): builder is AnySlashCommandBuilder<T>;
|
|
83
|
-
/**
|
|
84
|
-
* Is a slash command execute data
|
|
85
|
-
* @param executeData data to check
|
|
86
|
-
*/
|
|
87
|
-
static isSlashCommandExecuteData(executeData: unknown): executeData is SlashCommandExecuteData;
|
|
88
|
-
}
|
|
1
|
+
import { CommandType, CommandHaltFunction, CommandExecuteFunction, SharedCommandBuilderProperties, AnySlashCommandBuilder, SlashCommandData, AnySlashCommandOptionData, AnySlashCommandOptionBuilder } from '../../types/builders';
|
|
2
|
+
import { BaseCommandExecuteData, CommandHaltData } from '../../types/commands';
|
|
3
|
+
import { ChatInputCommandInteraction, PermissionResolvable, RestOrArray, SlashCommandBuilder as DiscordJsSlashCommandBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandBooleanOption, SlashCommandUserOption, SlashCommandChannelOption, SlashCommandRoleOption, SlashCommandAttachmentOption, SlashCommandMentionableOption, SlashCommandStringOption, SlashCommandIntegerOption, SlashCommandNumberOption, SharedSlashCommandOptions } from 'discord.js';
|
|
4
|
+
/**
|
|
5
|
+
* Execute data for slash command
|
|
6
|
+
*/
|
|
7
|
+
export interface SlashCommandExecuteData<T = unknown> extends BaseCommandExecuteData {
|
|
8
|
+
/**
|
|
9
|
+
* Command interaction
|
|
10
|
+
*/
|
|
11
|
+
interaction: ChatInputCommandInteraction;
|
|
12
|
+
/**
|
|
13
|
+
* Command Builder
|
|
14
|
+
*/
|
|
15
|
+
builder: AnySlashCommandBuilder<T>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Slash command halt data
|
|
19
|
+
*/
|
|
20
|
+
export declare type SlashCommandHaltData<T = unknown> = CommandHaltData<CommandType.SlashCommand, T>;
|
|
21
|
+
/**
|
|
22
|
+
* Slash command halt function
|
|
23
|
+
*/
|
|
24
|
+
export declare type SlashCommandHaltFunction<T = unknown> = CommandHaltFunction<CommandType.SlashCommand, T>;
|
|
25
|
+
/**
|
|
26
|
+
* Slash command execute function
|
|
27
|
+
*/
|
|
28
|
+
export declare type SlashCommandExecuteFunction<T = unknown> = CommandExecuteFunction<CommandType.SlashCommand, T>;
|
|
29
|
+
export declare type SlashCommandSubcommandsOnlyBuilder<T = unknown> = Omit<SlashCommandBuilder<T>, 'addBooleanOption' | 'addUserOption' | 'addChannelOption' | 'addRoleOption' | 'addAttachmentOption' | 'addMentionableOption' | 'addStringOption' | 'addIntegerOption' | 'addNumberOption'>;
|
|
30
|
+
export declare type SlashCommandOptionsOnlyBuilder<T = unknown> = Omit<SlashCommandBuilder<T>, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
31
|
+
export interface SlashCommandBuilder<T = unknown> extends DiscordJsSlashCommandBuilder {
|
|
32
|
+
addSubcommandGroup(input: SlashCommandSubcommandGroupBuilder | ((subcommandGroup: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder)): SlashCommandSubcommandsOnlyBuilder;
|
|
33
|
+
addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): SlashCommandSubcommandsOnlyBuilder;
|
|
34
|
+
addBooleanOption(input: SlashCommandBooleanOption | ((builder: SlashCommandBooleanOption) => SlashCommandBooleanOption)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
35
|
+
addUserOption(input: SlashCommandUserOption | ((builder: SlashCommandUserOption) => SlashCommandUserOption)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
36
|
+
addChannelOption(input: SlashCommandChannelOption | ((builder: SlashCommandChannelOption) => SlashCommandChannelOption)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
37
|
+
addRoleOption(input: SlashCommandRoleOption | ((builder: SlashCommandRoleOption) => SlashCommandRoleOption)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
38
|
+
addAttachmentOption(input: SlashCommandAttachmentOption | ((builder: SlashCommandAttachmentOption) => SlashCommandAttachmentOption)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
39
|
+
addMentionableOption(input: SlashCommandMentionableOption | ((builder: SlashCommandMentionableOption) => SlashCommandMentionableOption)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
40
|
+
addStringOption(input: SlashCommandStringOption | Omit<SlashCommandStringOption, 'setAutocomplete'> | Omit<SlashCommandStringOption, 'addChoices'> | ((builder: SlashCommandStringOption) => SlashCommandStringOption | Omit<SlashCommandStringOption, 'setAutocomplete'> | Omit<SlashCommandStringOption, 'addChoices'>)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
41
|
+
addIntegerOption(input: SlashCommandIntegerOption | Omit<SlashCommandIntegerOption, 'setAutocomplete'> | Omit<SlashCommandIntegerOption, 'addChoices'> | ((builder: SlashCommandIntegerOption) => SlashCommandIntegerOption | Omit<SlashCommandIntegerOption, 'setAutocomplete'> | Omit<SlashCommandIntegerOption, 'addChoices'>)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
42
|
+
addNumberOption(input: SlashCommandNumberOption | Omit<SlashCommandNumberOption, 'setAutocomplete'> | Omit<SlashCommandNumberOption, 'addChoices'> | ((builder: SlashCommandNumberOption) => SlashCommandNumberOption | Omit<SlashCommandNumberOption, 'setAutocomplete'> | Omit<SlashCommandNumberOption, 'addChoices'>)): Omit<this, 'addSubcommand' | 'addSubcommandGroup'>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Reciple builder for slash command
|
|
46
|
+
*/
|
|
47
|
+
export declare class SlashCommandBuilder<T = unknown> extends DiscordJsSlashCommandBuilder implements SharedCommandBuilderProperties<T> {
|
|
48
|
+
readonly type = CommandType.SlashCommand;
|
|
49
|
+
cooldown: number;
|
|
50
|
+
requiredBotPermissions: PermissionResolvable[];
|
|
51
|
+
requiredMemberPermissions: PermissionResolvable[];
|
|
52
|
+
halt?: SlashCommandHaltFunction<T>;
|
|
53
|
+
execute: SlashCommandExecuteFunction<T>;
|
|
54
|
+
metadata?: T;
|
|
55
|
+
constructor(data?: Partial<Omit<SlashCommandData<T>, 'type'>>);
|
|
56
|
+
setCooldown(cooldown: number): this;
|
|
57
|
+
setRequiredBotPermissions(...permissions: RestOrArray<PermissionResolvable>): this;
|
|
58
|
+
setRequiredMemberPermissions(...permissions: RestOrArray<PermissionResolvable>): this;
|
|
59
|
+
setHalt(halt?: SlashCommandHaltFunction<T> | null): this;
|
|
60
|
+
setExecute(execute: SlashCommandExecuteFunction<T>): this;
|
|
61
|
+
setMetadata(metadata?: T): this;
|
|
62
|
+
/**
|
|
63
|
+
* Add option builder to command builder
|
|
64
|
+
* @param builder Command/Subcommand builder
|
|
65
|
+
* @param option Option builder
|
|
66
|
+
*/
|
|
67
|
+
static addOption(builder: SharedSlashCommandOptions | SlashCommandBuilder, option: AnySlashCommandOptionBuilder): SharedSlashCommandOptions;
|
|
68
|
+
/**
|
|
69
|
+
* Resolve option data
|
|
70
|
+
* @param option Option dara to resolve
|
|
71
|
+
*/
|
|
72
|
+
static resolveOption<T extends AnySlashCommandOptionBuilder>(option: AnySlashCommandOptionData): T;
|
|
73
|
+
/**
|
|
74
|
+
* Resolve slash command data/builder
|
|
75
|
+
* @param commandData Command data to resolve
|
|
76
|
+
*/
|
|
77
|
+
static resolveSlashCommand<T = unknown>(commandData: SlashCommandData<T> | AnySlashCommandBuilder<T>): AnySlashCommandBuilder<T>;
|
|
78
|
+
/**
|
|
79
|
+
* Is a slash command builder
|
|
80
|
+
* @param builder data to check
|
|
81
|
+
*/
|
|
82
|
+
static isSlashCommandBuilder<T = unknown>(builder: unknown): builder is AnySlashCommandBuilder<T>;
|
|
83
|
+
/**
|
|
84
|
+
* Is a slash command execute data
|
|
85
|
+
* @param executeData data to check
|
|
86
|
+
*/
|
|
87
|
+
static isSlashCommandExecuteData(executeData: unknown): executeData is SlashCommandExecuteData;
|
|
88
|
+
}
|