Skip to content

Commit dbabbd5

Browse files
authored
Merge pull request #177 from Garlic-Team/dev
7.0.1
2 parents bdfcb7f + 1853fbf commit dbabbd5

File tree

6 files changed

+344
-319
lines changed

6 files changed

+344
-319
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gcommands",
3-
"version": "7.0.0",
3+
"version": "7.0.1",
44
"description": "Powerful and flexible command handler that can do everything!",
55
"main": "src/index.js",
66
"types": "./typings/index.d.ts",

src/commands/base.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ class Command {
5454
*/
5555
this.args = options.args;
5656

57+
/**
58+
* AlwaysObtain
59+
* @type {boolean}
60+
*/
61+
this.alwaysObtain = options.alwaysObtain ? Boolean(options.alwaysObtain) : false;
62+
5763
/**
5864
* MinArgs
5965
* @type {number}

src/managers/GEventHandling.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,10 @@ class GEventHandling {
232232
for (let i in cmdArgs) {
233233
let arg = new Argument(this.client, cmdArgs[i]);
234234
if (arg.type === 'invalid') continue;
235+
const rawArg = cmdArgs[1] ? args[i] : args.join(' ');
235236

236-
if (args[i]) {
237-
let argInvalid = await arg.argument.validate(arg, { content: args[i], guild: message.guild });
237+
if (rawArg && !commandos.alwaysObtain) {
238+
let argInvalid = await arg.argument.validate(arg, { content: rawArg, guild: message.guild });
238239
if (argInvalid) {
239240
let argInput = await arg.obtain(message, argInvalid);
240241
if (!argInput.valid) argInput = await validArg(arg, argInput.prompt);
@@ -254,13 +255,13 @@ class GEventHandling {
254255
}
255256
}
256257
} else {
257-
finalArgs.push(args[i]);
258+
finalArgs.push(rawArg);
258259

259-
if (ifNotSubOrGroup) objectArgs.push({ name: arg.name, value: args[i], type: arg.type });
260+
if (ifNotSubOrGroup) objectArgs.push({ name: arg.name, value: rawArg, type: arg.type });
260261

261262
for (const input of missingInput) {
262263
if (input.name === arg.name) {
263-
input.value = args[i];
264+
input.value = rawArg;
264265
}
265266
}
266267
}

0 commit comments

Comments
 (0)