Skip to content
This repository has been archived by the owner on Aug 28, 2020. It is now read-only.

Bug: parameters handled correctly when using quotedStringSupport with custom usageDelim #97

Closed
kyranet opened this issue Nov 25, 2017 · 1 comment
Assignees
Labels
Bug: Confirmed Issues that report confirmed bugs.

Comments

@kyranet
Copy link
Contributor

kyranet commented Nov 25, 2017

When quotedStringSupport is set to true and a command uses a usageDelim that is not a space, commands with the repeator tag do not work correctly. (Tested with user type).

Expected Behaviour

Klasa would get all users and send an array of users.

Actual Behaviour

When I input one user, it works perfectly, but it fails with two or more.

Command input

> $test 383383927575937034, 242043489611808769
Error: person must be a mention or valid user id.
> $test "383383927575937034" "242043489611808769"
Error: person must be a mention or valid user id.
> $test "383383927575937034", "242043489611808769"
Error: person must be a mention or valid user id.

Code to reproduce

const { Command } = require('klasa');

module.exports = class extends Command {

	constructor(...args) {
		super(...args, { usage: '<person:user> [...]', usageDelim: ', ' });
	}

	run(msg, [...user]) {
		return msg.send(`Mentioned: ${user.map(us => us.tag).join(', ')}`);
	}

};

Extra details

When quotedStringSupport is set to false, it does parse the ids correctly.

@kyranet kyranet added the Bug: Confirmed Issues that report confirmed bugs. label Nov 25, 2017
@kyranet
Copy link
Contributor Author

kyranet commented Nov 25, 2017

When using usageDelim: ', ', this behaviour happens:

> %args 383383927575937034, 242043489611808769
[ '383383927575937034', ' 242043489611808769' ]
> %args "383383927575937034", "242043489611808769"
[ '383383927575937034', ' ', '242043489611808769' ]

As noticed above, the first is adding a space before the second parameter instead of being removed (since usage delimiter is comma + space, and both parameters are separated by that); and the second one is adding an extra parameter with is a single space. Expected input for both should be:

[ '383383927575937034', '242043489611808769' ]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug: Confirmed Issues that report confirmed bugs.
Projects
None yet
Development

No branches or pull requests

2 participants