Androz2091 / discord-music-bot

The perfect music bot for your Discord server! 🤘
238 stars 128 forks source link

Bot will automatically skip over specific Youtube videos/links/tracks #24

Open bbpink217 opened 2 years ago

bbpink217 commented 2 years ago

Having an issue where I'll type in the name or paste a link to a specific video, and like the normal the bot will state its loading the track. However, when the message appears saying it started playing the track, immediately either the message saying "Queue finished" will appear or the next song that actually works in the queue will play. The bot will automatically skip over/not play the track at all. This isn't happening with all the tracks, just oddly specific tracks here and there.

I haven't edited the code for the bot beyond the setup steps.

The photo attached shows the messages from the bot sent all within less than a minute: wack

Errors I receive on console/command prompt when this error occurs: errors

not-pyroman commented 2 years ago

EDIT: one example that you can use to replicate this is Heavy from the Everhood OST (query: "heavy everhood") Same issue but slightly different errors, the errors don't seem to be consistent [Bot testing Server] Error emitted from the queue: write EPIPE [Bot testing Server] Error emitted from the queue: write EPIPE [Bot testing Server] Error emitted from the queue: Status code: 404

SyraDevelop commented 2 years ago

I'm having the same problem. I did some research on Youtube videos and it seems to depend on the video codec. When you right-click on a video, click on "Stats for nerds" and you will see the codec information. I guess that error occuring when codec is avc.

The version I am running is as follows discord-player: 5.1.0 Node.js: 16.9.1 Discord.js: 13.1.0

Example avc:https://www.youtube.com/watch?v=gsJ50jUl5Dw other(vp09):https://www.youtube.com/watch?v=WsUh4Oq5JU0

(Sorry,I using auto translate!)

itsmelonely commented 2 years ago

I have this issue as well. Still looking for cause.

hrolfurgylfa commented 2 years ago

This seems to also be an issue in the discord-player library as well which this bot relies on (same dev as this bot), it's being discussed in this issue and seems to be coming from the discord-ytdl-core library which that previous library relies on, as a very similar problem is being discussed in this issue.

samusaran commented 2 years ago

It seems that any video with video codec avc1.* just ends abruptly.

MeTonaTOR commented 2 years ago

Managed to fix that in a dirty-way. All you have to do is edit the discord-player/dist/Structures/Queue.js file with following changes:

Lines: 36-37

const PlayerError_1 = require("./PlayerError");
+ const ytdl = require("ytdl-core");

Lines: 637-639

+if (["youtube"].includes(track.raw.source)) {
+    stream = ytdl(track.url, { filter: 'audioonly' }, { passes: 3 })
+} else if (["spotify"].includes(track.raw.source)) {
-if (["youtube", "spotify"].includes(track.raw.source)) {

Lines: 667-669

const resource = this.connection.createStream(stream, {
+  type: (track.raw.source === "youtube") ? voice_1.StreamType.WebmOpus : voice_1.StreamType.Raw,
-  type: voice_1.StreamType.Raw,
   data: track
});
Euro-pol commented 2 years ago

Managed to fix that in a dirty-way. All you have to do is edit the discord-player/dist/Structures/Queue.js file with following changes:

Lines: 36-37

const PlayerError_1 = require("./PlayerError");
+ const ytdl = require("ytdl-core");

Lines: 637-639

+if (["youtube"].includes(track.raw.source)) {
+    stream = ytdl(track.url, { filter: 'audioonly' }, { passes: 3 })
+} else if (["spotify"].includes(track.raw.source)) {
-if (["youtube", "spotify"].includes(track.raw.source)) {

Lines: 667-669

const resource = this.connection.createStream(stream, {
+  type: (track.raw.source === "youtube") ? voice_1.StreamType.WebmOpus : voice_1.StreamType.Raw,
-  type: voice_1.StreamType.Raw,
   data: track
});

where do i find the dist folder

samusaran commented 2 years ago

Do the same thing in the src folder. The dist folder is for compiled source.

Sent from Ninehttp://www.9folders.com/


Da: timof121 @.***> Inviato: lunedì 11 ottobre 2021 12:32 A: Androz2091/discord-music-bot Cc: Alessandro Losi; Comment Oggetto: Re: [Androz2091/discord-music-bot] Bot will automatically skip over specific Youtube videos/links/tracks (#24)

Managed to fix that in a dirty-way. All you have to do is edit the discord-player/dist/Structures/Queue.js file with following changes:

Lines: 36-37

const PlayerError_1 = require("./PlayerError");

Lines: 637-639

+if (["youtube"].includes(track.raw.source)) {

Lines: 667-669

const resource = this.connection.createStream(stream, {

where do i find the dist folder

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/Androz2091/discord-music-bot/issues/24#issuecomment-939901922, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AACG7N7Q6OP3XWA52DO27QDUGK4NJANCNFSM5EAUX24A. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

nitpum commented 2 years ago

From https://github.com/Androz2091/discord-player/issues/848 We can fix in commands/play.js Line: 41

        const queue = await client.player.createQueue(guild, {
+            ytdlOptions: {
+                filter: 'audioonly',
+                highWaterMark: 1 << 25,
+                dlChunkSize: 0,
+            },
            metadata: channel
        });

maybe I should open pr for this

Olebeh commented 2 years ago

Managed to fix that in a dirty-way. All you have to do is edit the discord-player/dist/Structures/Queue.js file with following changes:

Lines: 36-37

const PlayerError_1 = require("./PlayerError");
+ const ytdl = require("ytdl-core");

Lines: 637-639

+if (["youtube"].includes(track.raw.source)) {
+    stream = ytdl(track.url, { filter: 'audioonly' }, { passes: 3 })
+} else if (["spotify"].includes(track.raw.source)) {
-if (["youtube", "spotify"].includes(track.raw.source)) {

Lines: 667-669

const resource = this.connection.createStream(stream, {
+  type: (track.raw.source === "youtube") ? voice_1.StreamType.WebmOpus : voice_1.StreamType.Raw,
-  type: voice_1.StreamType.Raw,
   data: track
});

sorry, but that didn't really help. Now it just makes noise and instantly leaves the vc. Maybe i did something wrong, but i tried to change the code a few times. Maybe you'll help