ZerioDev / Music-bot

A complete code to download for a cool Discord music bot !
https://discord.gg/5cGSYV8ZZj
GNU General Public License v3.0
869 stars 1.05k forks source link

Leaving after 2 seconds into track #205

Closed LegalSmeagol closed 1 year ago

LegalSmeagol commented 2 years ago

The issue here related to the leaving after 2 seconds into a track still persists despite the recent commit.

I have the following options set:

discordPlayer: { leaveOnEnd: false, leaveOnStop: true, leaveOnEmpty: true, leaveOnEmptyCooldown: 1000, autoSelfDeaf: true, ytdlOptions: { quality: 'highestaudio', highWaterMark: 1 << 25 } }

No errors in console.

milbits commented 2 years ago

leave the catboy alone!!1!1!1!1!1 πŸ˜‘πŸ˜‘πŸ˜‘πŸ€¬πŸ˜‘πŸ€¬πŸ˜‘πŸ€¬πŸ˜ πŸ˜Άβ€πŸŒ«οΈπŸ˜ πŸ₯ΆπŸ₯΅πŸ˜Άβ€πŸŒ«οΈπŸ₯ΆπŸ₯΅πŸ€¬πŸ€¬

CaptSpider4 commented 2 years ago

in play.js replace const queue = await player.createQueue(message.guild, { metadata: message.channel });

    with 
    `const queue = await player.createQueue(message.guild, {
        leaveOnEnd: false,
        leaveOnEmptyCooldown: 900000,
        metadata: message.channel
    });`
    You can remove that in config.js file. Also leaveonendcooldown doesnt work anymore

Btw dont remove ytdl options in config,js file

LegalSmeagol commented 2 years ago

in play.js replace const queue = await player.createQueue(message.guild, { metadata: message.channel });

    with 
    `const queue = await player.createQueue(message.guild, {
        leaveOnEnd: false,
        leaveOnEmptyCooldown: 900000,
        metadata: message.channel
    });`
    You can remove that in config.js file. Also leaveonendcooldown doesnt work anymore

Btw dont remove ytdl options in config,js file

Thank you but unfortunately this doesn't help my issue. The bot is still leaving within 2 seconds of playing certain tracks.

CaptSpider4 commented 2 years ago

There might be some error in the console check that

LegalSmeagol commented 2 years ago

There might be some error in the console check that

I wish there were errors in console, but nothing appears in console when it happens.

ToshkaPz commented 2 years ago

If you solve this issue please share how you did it, as I have the same problem. (only when you play links for some reason)

LegalSmeagol commented 2 years ago

If you solve this issue please share how you did it, as I have the same problem. (only when you play links for some reason)

Unfortunately I haven't found any solution. However, you've allowed me to identify a better correlation - this does only occur when playing links. Searching by keywords, the audio is completely fine and plays the whole way through.

Hope this can get fixed soon.

Jacob439 commented 2 years ago

The same thing is happening to me for certain tracks. One example is "trust me I'm an engineer". This fails during search and when the link is played. https://youtu.be/rp8hvyjZWHs

Arburich commented 2 years ago

Can confirm my bot is doing the same thing. CaptSpider4's fix stops the bot from leaving the channel but doesn't let the music continue.

Arburich commented 2 years ago

add to play.js


const queue = await player.createQueue(message.guild, {
            ytdlOptions: {
                quality: "highest",
                filter: "audioonly",
                highWaterMark: 1 << 25,
                dlChunkSize: 0,
            },
            metadata: message.channel
        });```
LegalSmeagol commented 2 years ago

add to play.js

const queue = await player.createQueue(message.guild, {
          ytdlOptions: {
              quality: "highest",
              filter: "audioonly",
              highWaterMark: 1 << 25,
              dlChunkSize: 0,
          },
          metadata: message.channel
      });```

Looks like this fixes the issue. Upon testing with the original sound I noticed this issue with, the bot now plays the entire track.

tstern27 commented 2 years ago

@Arburich Thank you so much!

I was having the same issue where youtube links would play only play audio for a second and then cut out.

I can confirm the above solutions resolved my problem as well.

revot334 commented 1 year ago

fixed in new discord player version