Skip to content

Commit

Permalink
fix: fixed args#restResult including leading space (#531)
Browse files Browse the repository at this point in the history
* chore: ignore build artifacts

* fix: remove leading space in Args#restResult()
closes #529

* chore(deps): update @sapphire/lexure to 1.1.0

* chore: use new join function from lexure

* Update src/lib/parsers/Args.ts

Co-authored-by: Jeroen Claassens <jeroen.claassens@live.nl>

Co-authored-by: Jeroen Claassens <jeroen.claassens@live.nl>
  • Loading branch information
BenSegal855 and favna committed Sep 21, 2022
1 parent 581235f commit 3e560c6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -24,4 +24,7 @@ package-lock.json
gh

# Ignore the "wiki" folder so we can checkout the wiki inside the same folder
wiki/
wiki/

# Ignore build artifacts
*.tgz
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -31,7 +31,7 @@
"@discordjs/builders": "^0.16.0",
"@sapphire/discord-utilities": "^2.11.6",
"@sapphire/discord.js-utilities": "^5.0.0",
"@sapphire/lexure": "^1.0.2",
"@sapphire/lexure": "^1.1.0",
"@sapphire/pieces": "^3.5.1",
"@sapphire/ratelimits": "^2.4.4",
"@sapphire/result": "^2.4.1",
Expand Down
7 changes: 2 additions & 5 deletions src/lib/parsers/Args.ts
@@ -1,5 +1,5 @@
import type { ChannelTypes, GuildBasedChannelTypes } from '@sapphire/discord.js-utilities';
import type { ArgumentStream, Parameter } from '@sapphire/lexure';
import { join, type ArgumentStream, type Parameter } from '@sapphire/lexure';
import { container } from '@sapphire/pieces';
import { Option, Result } from '@sapphire/result';
import type { Awaitable } from '@sapphire/utilities';
Expand Down Expand Up @@ -201,10 +201,7 @@ export class Args {
if (this.parser.finished) return this.missingArguments();

const state = this.parser.save();
const data = this.parser
.many()
.unwrapOr<Parameter[]>([])
.reduce((acc, parameter) => `${acc}${parameter.leading}${parameter.value}`, '');
const data = join(this.parser.many().unwrapOr<Parameter[]>([]));
const result = await argument.run(data, {
args: this,
argument,
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Expand Up @@ -546,7 +546,7 @@ __metadata:
"@sapphire/discord-utilities": ^2.11.6
"@sapphire/discord.js-utilities": ^5.0.0
"@sapphire/eslint-config": ^4.3.8
"@sapphire/lexure": ^1.0.2
"@sapphire/lexure": ^1.1.0
"@sapphire/pieces": ^3.5.1
"@sapphire/prettier-config": ^1.4.4
"@sapphire/ratelimits": ^2.4.4
Expand Down Expand Up @@ -582,12 +582,12 @@ __metadata:
languageName: unknown
linkType: soft

"@sapphire/lexure@npm:^1.0.2":
version: 1.0.2
resolution: "@sapphire/lexure@npm:1.0.2"
"@sapphire/lexure@npm:^1.1.0":
version: 1.1.0
resolution: "@sapphire/lexure@npm:1.1.0"
dependencies:
"@sapphire/result": ^2.4.1
checksum: 83ffbeb60c93a663bf7eea5677545a6f974744ef5dbc9aad32b7e4684ef2fe11472ffe82455bc326e1f855a154af742c7b3021b4848ff32c8b816636c6dad833
checksum: 7c8f9d356c3f7a67c72748561ca0043e41ca8025ca560f918ed677a3add52f2ad0d0196e432317c50e832881bade49dee03e0f957f763965919ebf1ce922e82f
languageName: node
linkType: hard

Expand Down

0 comments on commit 3e560c6

Please sign in to comment.