From f2da9a27a047bce618565958841dc3e5cc8443a0 Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Mon, 8 Aug 2022 12:50:08 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=BE=D0=B1=D1=83?= =?UTF-8?q?=D0=B5=D0=BC=20=D1=82=D0=B0=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/JaBa.js | 4 ++-- commands/Music/play.js | 11 ++++++++--- package-lock.json | 18 +++++++++--------- package.json | 2 +- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/base/JaBa.js b/base/JaBa.js index 3730aa55..c7b17ab2 100644 --- a/base/JaBa.js +++ b/base/JaBa.js @@ -11,7 +11,7 @@ const BaseEvent = require("./BaseEvent.js"), path = require("path"), fs = require("fs").promises, mongoose = require("mongoose"), - extractor = require("../helpers/extractor"), + // extractor = require("../helpers/extractor"), playdl = require("play-dl"), moment = require("moment"); @@ -60,7 +60,7 @@ class JaBa extends Client { }); this.player = new Player(this); - this.player.use("jaba", extractor); + // this.player.use("jaba", extractor); this.player .on("trackStart", async (queue, track) => { diff --git a/commands/Music/play.js b/commands/Music/play.js index ae8497fb..8640b8e3 100644 --- a/commands/Music/play.js +++ b/commands/Music/play.js @@ -1,5 +1,6 @@ const { SlashCommandBuilder, PermissionsBitField } = require("discord.js"); -const BaseCommand = require("../../base/BaseCommand"); +const BaseCommand = require("../../base/BaseCommand"), + playdl = require("play-dl"); class Play extends BaseCommand { /** @@ -43,7 +44,7 @@ class Play extends BaseCommand { const searchResult = await client.player.search(query, { requestedBy: interaction.user, - searchEngine: "jaba" + // searchEngine: "jaba" }).catch(() => {}); if (!searchResult || !searchResult.tracks.length) return interaction.editReply({ content: interaction.translate("music/play:NO_RESULT", { @@ -59,7 +60,11 @@ class Play extends BaseCommand { leaveOnStop: true, bufferingTimeout: 1000, disableVolume: false, - spotifyBridge: false + spotifyBridge: false, + async onBeforeCreateStream(track, source) { + if (source === "youtube" || source === "soundcloud") + return (await playdl.stream(track.url, { discordPlayerCompatibility: true })).stream; + } }); searchResult.playlist ? queue.addTracks(searchResult.tracks) : queue.addTrack(searchResult.tracks[0]); diff --git a/package-lock.json b/package-lock.json index 8adfe6c9..960ce762 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "cron": "^1.7.2", "discord-api-types": "^0.37.0", "discord-giveaways": "^6.0.0", - "discord-player": "^5.3.0", + "discord-player": "^5.3.0-dev.3", "discord.js": "^14.1.2", "ejs": "^3.1.3", "express": "^4.17.1", @@ -1371,9 +1371,9 @@ } }, "node_modules/discord-player": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/discord-player/-/discord-player-5.3.0.tgz", - "integrity": "sha512-OskERYrsVqNvyq8tKkp3aV3NMY9dP5BhNeyn5NTTDohVd9eEE8P6rZGvxqORJl1OxXCTBLbiojNgLiFNsAIaow==", + "version": "5.3.0-dev.3", + "resolved": "https://registry.npmjs.org/discord-player/-/discord-player-5.3.0-dev.3.tgz", + "integrity": "sha512-rrbEBS4mzCyIGk5S9E5O0XWnC4nub2cmBAFr9pZLH7RWBX4+z2nhAt5VwemgenmW/RJy1rseuZZ75WqJDnrHnw==", "dependencies": { "@discordjs/voice": "^0.11.0", "libsodium-wrappers": "^0.7.10", @@ -1381,7 +1381,7 @@ "spotify-url-info": "^3.1.2", "tiny-typed-emitter": "^2.1.0", "tslib": "^2.4.0", - "youtube-sr": "^4.3.0", + "youtube-sr": "^4.2.0", "ytdl-core": "^4.11.0" }, "funding": { @@ -5754,9 +5754,9 @@ } }, "discord-player": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/discord-player/-/discord-player-5.3.0.tgz", - "integrity": "sha512-OskERYrsVqNvyq8tKkp3aV3NMY9dP5BhNeyn5NTTDohVd9eEE8P6rZGvxqORJl1OxXCTBLbiojNgLiFNsAIaow==", + "version": "5.3.0-dev.3", + "resolved": "https://registry.npmjs.org/discord-player/-/discord-player-5.3.0-dev.3.tgz", + "integrity": "sha512-rrbEBS4mzCyIGk5S9E5O0XWnC4nub2cmBAFr9pZLH7RWBX4+z2nhAt5VwemgenmW/RJy1rseuZZ75WqJDnrHnw==", "requires": { "@discordjs/voice": "^0.11.0", "libsodium-wrappers": "^0.7.10", @@ -5764,7 +5764,7 @@ "spotify-url-info": "^3.1.2", "tiny-typed-emitter": "^2.1.0", "tslib": "^2.4.0", - "youtube-sr": "^4.3.0", + "youtube-sr": "^4.2.0", "ytdl-core": "^4.11.0" } }, diff --git a/package.json b/package.json index 46304fad..a2d6eef5 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "cron": "^1.7.2", "discord-api-types": "^0.37.0", "discord-giveaways": "^6.0.0", - "discord-player": "^5.3.0", + "discord-player": "^5.3.0-dev.3", "discord.js": "^14.1.2", "ejs": "^3.1.3", "express": "^4.17.1",