Skip to content

Commit 5a5da80

Browse files
retrouser955twlite
andauthored
Add soundcloud regex (#1932)
* Add soundcloud regex * Update package.json --------- Co-authored-by: Twilight <46562212+twlite@users.noreply.github.com>
1 parent 16bd4e2 commit 5a5da80

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"build:web": "turbo run build --filter=website",
2020
"start:web": "turbo run preview --filter=website",
2121
"test": "turbo run test --color",
22-
"bot": "yarn workspace music-bot start"
22+
"start:bot": "yarn workspace music-bot start",
23+
"build:bot": "yarn workspace music-bot build"
2324
},
2425
"repository": {
2526
"type": "git",

packages/discord-player/__test__/QueryResolver.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ describe('QueryResolver', () => {
4949
expect(qr.resolve(query).type).toBe(QueryType.VIMEO);
5050
});
5151

52+
it("should be soundcloud", async () => {
53+
const query = "https://on.soundcloud.com/YVLyjzk2mmp5TJF99"
54+
const rediected = await qr.preResolve(query)
55+
expect(rediected).toMatch(qr.regex.soundcloudTrackRegex)
56+
})
57+
5258
it('should be soundcloudTrack', () => {
5359
const query = 'https://soundcloud.com/rick-astley-official/never-gonna-give-you-up-4';
5460
expect(qr.resolve(query).type).toBe(QueryType.SOUNDCLOUD_TRACK);

packages/discord-player/src/utils/QueryResolver.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const DomainsMap = {
3232
// prettier-ignore
3333
const redirectDomains = new Set([
3434
/^https?:\/\/spotify.link\/[A-Za-z0-9]+$/,
35+
/^https:\/\/on\.soundcloud\.com\/[a-zA-Z1-9]{0,17}$/
3536
]);
3637

3738
export interface ResolvedQuery {
@@ -58,7 +59,7 @@ class QueryResolver {
5859
appleMusicSongRegex,
5960
soundcloudTrackRegex,
6061
soundcloudPlaylistRegex,
61-
youtubePlaylistRegex
62+
youtubePlaylistRegex,
6263
};
6364
}
6465

0 commit comments

Comments
 (0)