diff --git a/base/Client.js b/base/Client.js index fb8e06e4..f9e0a4ac 100644 --- a/base/Client.js +++ b/base/Client.js @@ -3,7 +3,7 @@ const { Client, Collection, SlashCommandBuilder, ContextMenuCommandBuilder, Embe { REST } = require("@discordjs/rest"), { Player: DiscordPlayer } = require("discord-player"), { SpotifyExtractor } = require("@discord-player/extractor"), - { YoutubeiExtractor, createYoutubeiStream } = require("discord-player-youtubei"), + { YoutubeiExtractor } = require("discord-player-youtubei"), { Routes } = require("discord-api-types/v10"); const BaseEvent = require("./BaseEvent.js"), @@ -43,28 +43,11 @@ class JaBaClient extends Client { * @returns {Promise} A Promise that resolves when the client is fully initialized. */ async init() { - this.player = new DiscordPlayer(this, { - ytdlOptions: { - requestOptions: { - headers: { - cookie: this.config.youtubeCookie, - }, - }, - }, - }); + this.player = new DiscordPlayer(this); - await this.player.extractors.register(YoutubeiExtractor, { - // authentication: { - // access_token: process.env.YT_ACCESS_TOKEN || "", - // refresh_token: process.env.YT_REFRESH_TOKEN || "", - // scope: "https://www.googleapis.com/auth/youtube https://www.googleapis.com/auth/youtube-paid-content", - // token_type: "Bearer", - // expiry_date: "2024-07-10T11:37:01.093Z", - // }, - }); + await this.player.extractors.register(YoutubeiExtractor); await this.player.extractors.register(SpotifyExtractor, { - createStream: createYoutubeiStream, clientId: this.config.spotify.clientId, clientSecret: this.config.spotify.clientSecret, }); diff --git a/commands/Music/play.js b/commands/Music/play.js index c7d2c862..cf003681 100644 --- a/commands/Music/play.js +++ b/commands/Music/play.js @@ -86,7 +86,7 @@ class Play extends BaseCommand { if (query.startsWith("http")) return interaction.respond([ { name: "Current Link", value: query } ]); const youtubeResults = await client.player.search(query, { searchEngine: QueryType.YOUTUBE }); - // const spotifyResults = await client.player.search(query, { searchEngine: QueryType.SPOTIFY_SEARCH }); + const spotifyResults = await client.player.search(query, { searchEngine: QueryType.SPOTIFY_SEARCH }); const tracks = []; youtubeResults.tracks @@ -97,13 +97,13 @@ class Play extends BaseCommand { })) .forEach(t => tracks.push({ name: t.name, value: t.value })); - // spotifyResults.tracks - // .slice(0, 5) - // .map(t => ({ - // name: `Spotify: ${`${t.title} - ${t.author} (${t.duration})`.length > 75 ? `${`${t.title} - ${t.author}`.substring(0, 75)}... (${t.duration})` : `${t.title} - ${t.author} (${t.duration})`}`, - // value: t.url, - // })) - // .forEach(t => tracks.push({ name: t.name, value: t.value })); + spotifyResults.tracks + .slice(0, 5) + .map(t => ({ + name: `Spotify: ${`${t.title} - ${t.author} (${t.duration})`.length > 75 ? `${`${t.title} - ${t.author}`.substring(0, 75)}... (${t.duration})` : `${t.title} - ${t.author} (${t.duration})`}`, + value: t.url, + })) + .forEach(t => tracks.push({ name: t.name, value: t.value })); return interaction.respond(tracks); } diff --git a/package.json b/package.json index ed606c0a..5c2edb05 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ }, "author": "@jonny_bro", "dependencies": { - "@discord-player/extractor": "^4.4.7", + "@discord-player/extractor": "^4.5.0", "@discordjs/opus": "^0.9.0", "@discordjs/rest": "^2.3.0", "@discordjs/voice": "^0.17.0", @@ -17,8 +17,8 @@ "cron": "^2.4.4", "discord-api-types": "^0.37.92", "discord-giveaways": "^6.0.1", - "discord-player": "^6.6.10", - "discord-player-youtubei": "^1.1.10", + "discord-player": "^6.7.0", + "discord-player-youtubei": "^1.1.14", "discord.js": "^14.15.3", "gamedig": "^4.1.0", "i18next": "^21.10.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 111713ba..e810c6c8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@discord-player/extractor': - specifier: ^4.4.7 - version: 4.4.7 + specifier: ^4.5.0 + version: 4.5.0 '@discordjs/opus': specifier: ^0.9.0 version: 0.9.0 @@ -36,11 +36,11 @@ importers: specifier: ^6.0.1 version: 6.0.1(discord.js@14.15.3) discord-player: - specifier: ^6.6.10 - version: 6.6.10(@discord-player/extractor@4.4.7)(@discordjs/opus@0.9.0) + specifier: ^6.7.0 + version: 6.7.0(@discord-player/extractor@4.5.0)(@discordjs/opus@0.9.0) discord-player-youtubei: - specifier: ^1.1.10 - version: 1.1.10 + specifier: ^1.1.14 + version: 1.1.14 discord.js: specifier: ^14.15.3 version: 14.15.3 @@ -89,8 +89,8 @@ packages: '@discord-player/equalizer@0.2.3': resolution: {integrity: sha512-71UAepYMbHTg2QQLXQAgyuXYHrgAYpJDxjg9dRWfTUNf+zfOAlyJEiRRk/WFhQyGu6m23iLR/H/JxgF4AW8Csg==} - '@discord-player/extractor@4.4.7': - resolution: {integrity: sha512-XHG9Y45rQVWk3quf0IJqAj1ybTqiRgAy6vr5hnlaDZeaxXlsHRlDSzmSYl+teFVw2G9bjzR0jIvm8a4BW9hCBw==} + '@discord-player/extractor@4.5.0': + resolution: {integrity: sha512-7yCvNNMbRIkFewli/ILcbFe9FX8DaTFTajn6ouJ/+76NzjoPsPNGRNmDT6eP69t/DJJrZFhsghyGGmxDKNBo6A==} '@discord-player/ffmpeg@0.1.0': resolution: {integrity: sha512-0kW6q4gMQN2B4Z4EzmUgXrKQSXXmyhjdZBBZ/6jSHZ9fh814oOu+JXP01VvtWHwTylI7qJHIctEWtSyjEubCJg==} @@ -474,14 +474,14 @@ packages: peerDependencies: discord.js: '>=14.0.0' - discord-player-youtubei@1.1.10: - resolution: {integrity: sha512-6ueEViUB4GQ1djQG/IZnWdGwdViJeMFmJteD8QVa+XiztoEkAPlmqpcxia4PDbkFGIrjGmYYFVnVFl+PJSZoAg==} + discord-player-youtubei@1.1.14: + resolution: {integrity: sha512-W+eaemsDABUEWiYu0O1WFs8QgBy7b/ZO7+PVX0NZdo8vpIIxodalv6ZA7w9WfSz2YlQnvlSVXGabYodEz4vrkA==} hasBin: true - discord-player@6.6.10: - resolution: {integrity: sha512-AOZnJYXOoe2hF2OENwKUIaKJ2H5U8VfxcoMKDXE++9Rnbzd7qD8MQr9Am01T1UiiPf2BWjyHin97EUm1nrTJKA==} + discord-player@6.7.0: + resolution: {integrity: sha512-ioSDZo3IreTi9B5ZRKca0Vh2FPbHjM25D4RoXTwhf6ULaGJEMMpi+GAyDPtzFGHbvIO0Fs/pnNcKtehICsODzg==} peerDependencies: - '@discord-player/extractor': ^4.4.7 + '@discord-player/extractor': ^4.5.0 discord-voip@0.1.3: resolution: {integrity: sha512-9DWY5/BLPXeldVwPr8/ggGjggTYOTw77aGQc3+4n5K54bRbbiJ9DUJc+mJzDiSLoHN3f286eRGACJYtrUu27xA==} @@ -1210,10 +1210,6 @@ packages: resolution: {integrity: sha512-Q2rtqmZWrbP8nePMq7mOJIN98M0fYvSgV89vwl/BQRT4mDOeY2GXZngfGpcBBhtky3woM7G24wZV3Q304Bv6cw==} engines: {node: '>=18.0'} - undici@6.15.0: - resolution: {integrity: sha512-VviMt2tlMg1BvQ0FKXxrz1eJuyrcISrL2sPfBf7ZskX/FCEc/7LeThQaoygsMJpNqrATWQIsRVx+1Dpe4jaYuQ==} - engines: {node: '>=18.17'} - undici@6.19.2: resolution: {integrity: sha512-JfjKqIauur3Q6biAtHJ564e3bWa8VvT+7cSiOJHFbX4Erv6CLGDpg8z+Fmg/1OI/47RA+GI2QZaF48SSaLvyBA==} engines: {node: '>=18.17'} @@ -1259,18 +1255,6 @@ packages: wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - ws@8.14.2: - resolution: {integrity: sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: '>=5.0.2' - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - ws@8.17.1: resolution: {integrity: sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==} engines: {node: '>=10.0.0'} @@ -1318,7 +1302,7 @@ snapshots: '@discord-player/equalizer@0.2.3': {} - '@discord-player/extractor@4.4.7': + '@discord-player/extractor@4.5.0': dependencies: file-type: 16.5.4 genius-lyrics: 4.4.7 @@ -1723,15 +1707,15 @@ snapshots: discord.js: 14.15.3 serialize-javascript: 6.0.1 - discord-player-youtubei@1.1.10: + discord-player-youtubei@1.1.14: dependencies: undici: 6.19.2 youtubei.js: 10.1.0 - discord-player@6.6.10(@discord-player/extractor@4.4.7)(@discordjs/opus@0.9.0): + discord-player@6.7.0(@discord-player/extractor@4.5.0)(@discordjs/opus@0.9.0): dependencies: '@discord-player/equalizer': 0.2.3 - '@discord-player/extractor': 4.4.7 + '@discord-player/extractor': 4.5.0 '@discord-player/ffmpeg': 0.1.0 '@discord-player/utils': 0.2.2 '@web-scrobbler/metadata-filter': 3.1.0 @@ -1754,7 +1738,7 @@ snapshots: discord-api-types: 0.37.92 prism-media: 1.3.5(@discordjs/opus@0.9.0) tslib: 2.6.2 - ws: 8.14.2 + ws: 8.17.1 transitivePeerDependencies: - '@discordjs/opus' - bufferutil @@ -1964,7 +1948,7 @@ snapshots: genius-lyrics@4.4.7: dependencies: node-html-parser: 6.1.13 - undici: 6.15.0 + undici: 6.19.2 get-stream@6.0.1: {} @@ -2513,8 +2497,6 @@ snapshots: undici@6.13.0: {} - undici@6.15.0: {} - undici@6.19.2: {} unfetch@5.0.0: {} @@ -2553,8 +2535,6 @@ snapshots: wrappy@1.0.2: {} - ws@8.14.2: {} - ws@8.17.1: {} xmlbuilder@8.2.2: {}