reciple 4.0.0-pre.2 → 4.0.0-pre.3
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/bin/reciple/classes/MessageCommandOptionManager.d.ts +1 -1
- package/bin/reciple/classes/MessageCommandOptionManager.js +2 -3
- package/bin/reciple/classes/RecipleClient.js +2 -2
- package/bin/reciple/classes/builders/MessageCommandBuilder.d.ts +0 -6
- package/bin/reciple/classes/builders/MessageCommandBuilder.js +1 -10
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ export declare class MessageCommandOptionManager extends Array<MessageCommandVal
|
|
|
6
6
|
/**
|
|
7
7
|
* @param options Validated options
|
|
8
8
|
*/
|
|
9
|
-
constructor(options: MessageCommandValidatedOption[]);
|
|
9
|
+
constructor(...options: MessageCommandValidatedOption[]);
|
|
10
10
|
/**
|
|
11
11
|
* Get the option info
|
|
12
12
|
* @param name Option name
|
|
@@ -8,9 +8,8 @@ class MessageCommandOptionManager extends Array {
|
|
|
8
8
|
/**
|
|
9
9
|
* @param options Validated options
|
|
10
10
|
*/
|
|
11
|
-
constructor(options) {
|
|
12
|
-
super();
|
|
13
|
-
this.push(...options);
|
|
11
|
+
constructor(...options) {
|
|
12
|
+
super(...(options !== null && options !== void 0 ? options : []));
|
|
14
13
|
}
|
|
15
14
|
get(name, required) {
|
|
16
15
|
const option = this.find(o => o.name == name);
|
|
@@ -195,13 +195,13 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
195
195
|
return;
|
|
196
196
|
if (command.validateOptions) {
|
|
197
197
|
if (commandOptions.some(o => o.invalid)) {
|
|
198
|
-
if (!(yield this._haltCommand(command, { executeData, reason: commands_1.HaltedCommandReason.InvalidArguments, invalidArguments: new MessageCommandOptionManager_1.MessageCommandOptionManager(executeData.options.filter(o => o.invalid)) }))) {
|
|
198
|
+
if (!(yield this._haltCommand(command, { executeData, reason: commands_1.HaltedCommandReason.InvalidArguments, invalidArguments: new MessageCommandOptionManager_1.MessageCommandOptionManager(...executeData.options.filter(o => o.invalid)) }))) {
|
|
199
199
|
message.reply(this.getMessage('invalidArguments', 'Invalid argument(s) given.')).catch(er => this._replyError(er));
|
|
200
200
|
}
|
|
201
201
|
return;
|
|
202
202
|
}
|
|
203
203
|
if (commandOptions.some(o => o.missing)) {
|
|
204
|
-
if (!(yield this._haltCommand(command, { executeData, reason: commands_1.HaltedCommandReason.MissingArguments, missingArguments: new MessageCommandOptionManager_1.MessageCommandOptionManager(executeData.options.filter(o => o.missing)) }))) {
|
|
204
|
+
if (!(yield this._haltCommand(command, { executeData, reason: commands_1.HaltedCommandReason.MissingArguments, missingArguments: new MessageCommandOptionManager_1.MessageCommandOptionManager(...executeData.options.filter(o => o.missing)) }))) {
|
|
205
205
|
message.reply(this.getMessage('missingArguments', 'Not enough arguments.')).catch(er => this._replyError(er));
|
|
206
206
|
}
|
|
207
207
|
return;
|
|
@@ -103,11 +103,5 @@ export declare class MessageCommandBuilder {
|
|
|
103
103
|
* @param validateOptions `true` if the command options needs to be validated before executing
|
|
104
104
|
*/
|
|
105
105
|
setValidateOptions(validateOptions: boolean): MessageCommandBuilder;
|
|
106
|
-
/**
|
|
107
|
-
* validate given command options
|
|
108
|
-
* @deprecated use `validateMessageCommandOptions()` instead
|
|
109
|
-
* @param options Parsed message command data
|
|
110
|
-
*/
|
|
111
|
-
getCommandOptionValues(options: CommandMessage): MessageCommandOptionManager;
|
|
112
106
|
}
|
|
113
107
|
export declare function validateMessageCommandOptions(builder: MessageCommandBuilder, options: CommandMessage): MessageCommandOptionManager;
|
|
@@ -144,15 +144,6 @@ class MessageCommandBuilder {
|
|
|
144
144
|
this.validateOptions = validateOptions;
|
|
145
145
|
return this;
|
|
146
146
|
}
|
|
147
|
-
/**
|
|
148
|
-
* validate given command options
|
|
149
|
-
* @deprecated use `validateMessageCommandOptions()` instead
|
|
150
|
-
* @param options Parsed message command data
|
|
151
|
-
*/
|
|
152
|
-
// TODO: Remove this on the next major update
|
|
153
|
-
getCommandOptionValues(options) {
|
|
154
|
-
return validateMessageCommandOptions(this, options);
|
|
155
|
-
}
|
|
156
147
|
}
|
|
157
148
|
exports.MessageCommandBuilder = MessageCommandBuilder;
|
|
158
149
|
function validateMessageCommandOptions(builder, options) {
|
|
@@ -186,6 +177,6 @@ function validateMessageCommandOptions(builder, options) {
|
|
|
186
177
|
result.push(value);
|
|
187
178
|
i++;
|
|
188
179
|
}
|
|
189
|
-
return new MessageCommandOptionManager_1.MessageCommandOptionManager(result);
|
|
180
|
+
return new MessageCommandOptionManager_1.MessageCommandOptionManager(...result);
|
|
190
181
|
}
|
|
191
182
|
exports.validateMessageCommandOptions = validateMessageCommandOptions;
|