Попробуем так

This commit is contained in:
JonnyBro 2022-08-08 12:50:08 +05:00
parent 2b95b5687e
commit f2da9a27a0
4 changed files with 20 additions and 15 deletions

View file

@ -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) => {

View file

@ -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]);

18
package-lock.json generated
View file

@ -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"
}
},

View file

@ -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",