Skip to content

Commit

Permalink
fix(REST): check for url first
Browse files Browse the repository at this point in the history
  • Loading branch information
KagChi committed Mar 14, 2022
1 parent d90fd7e commit 644802a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": {
"name": "KagChi"
},
"version": "0.1.1",
"version": "0.1.2",
"license": "GPL-3.0",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
6 changes: 5 additions & 1 deletion src/Structures/REST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ export class REST {
public loadTracks(options: { source?: LavalinkSource; query: string } | string) {
if (typeof options === 'string') {
return this.get<LoadTrackResponse>(
`loadtracks?identifier=${encodeURIComponent(`${this.resolveIdentifier(LavalinkSourceEnum.Youtube)}:${options}`)}`
`loadtracks?identifier=${
this.isUrl(options)
? encodeURIComponent(options)
: encodeURIComponent(`${this.resolveIdentifier(LavalinkSourceEnum.Youtube)}:${options}`)
}`
);
}
const source = options.source ?? LavalinkSourceEnum.Youtube;
Expand Down

0 comments on commit 644802a

Please sign in to comment.