I made a discord.js music bot and it worked. Playing music etc. But sometimes the bot join the voice channel and do nothing
`if(!message.member.voiceChannel) return message.channel.send("Bitte geh in ein Sprach-Kanal!")
if(message.guild.me.voiceChannel) return message.channel.send("Ich bin schon auf diesem Server, in einem Sprach-Kanal!")
if(!args[0]) return message.channel.send("Du musst eine URL angeben!")
let validate = await ytdl.validateURL(args[0])
if(!validate) return message.channel.send("Bitte gib eine echte URL an!")
let info = await ytdl.getInfo(args[0])
let connection = await message.member.voiceChannel.join();
let dispatcher = await connection.playStream(ytdl(args[0], { filter: 'audioonly'}));
let thumbnail = 'https://img.youtube.com/vi/' + info.player_response.videoDetails.videoId + '/0.jpg'
var minutes = Math.floor(info.player_response.videoDetails.lengthSeconds / 60);
var secs = info.player_response.videoDetails.lengthSeconds % 60;
const embed = new Discord.RichEmbed()
.setTitle(Ich spiele nun **${info.player_response.videoDetails.title}** von **${info.author.name}**)
.addField(Video Zeit in Minuten, ${minutes}:${secs}, true)
.addField(Video Link, [Klicke hier](${args[0]}), true)
.addField(Video Autor, [Klicke hier](${info.author.user_url}), true)
.setThumbnail(thumbnail)
message.channel.send(embed)`
Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.54. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
not sure. is there an error thrown?
actualy i m having same issue , thing happen is i m using ytdl-core to play queue of song which is larger then 500 sub music url's within a List ...after some hour its shows dispatcher is still playing but no audio coming out of it.
The way i m storing data in my main queue
after pushing in proper Queue value : [
{
id: 'fMuEcJv-Uh8',
name: 'Nightcore - You Want My Sister',
url: 'https://www.youtube.com/watch?v=fMuEcJv-Uh8',
thumbnail: 'https://i.ytimg.com/vi/fMuEcJv-Uh8/hqdefault.jpg'
},
{
id: 'LEFE9UBYSjU',
name: 'Nightcore - Who Says || Lyrics',
url: 'https://www.youtube.com/watch?v=LEFE9UBYSjU',
thumbnail: 'https://i.ytimg.com/vi/LEFE9UBYSjU/maxresdefault.jpg'
}
]
main code to play localarray queue -
function play_stream()
{
const voicechannel = client.channels.get('594409374122770432');
if (!voicechannel) return console.error("The channel does not exist!");
voicechannel.join()
.then(connection =>{
let stream = ytdl(localarray[0].url).on("error", err =>{
client.user.setActivity("stream went offline!");
console.log(err);
});
isplaying = true;
console.log("stream started!");
let dispatcher = connection.playStream(stream);
console.log("current playing Item : name "+localarray[0].name+" || url : "+localarray[0].url);
dispatcher.on('end',function(){
if(stop == true)
{
stop = false;
isplaying = false;
dispatcher.destroy();
voicechannel.leave();
}
else
{
client.user.setActivity("Zen-Kun Radio 24/7 Hemantk|| ^help");
console.log("Next track started : ")
localarray.push(localarray.shift());
play_stream();
}
})
dispatcher.on('error', function(){
message.channel.send("sorry stream is Offline !")
})
});
console.log("Successfully connected.");
}
i tried all stuff highwatermark and all...same thing nothing changed.
I wanna say this is related to #402, ultimately d.js doesn't get the "end" or "finish" event from the writeable stream so the music appears to just stop randomly.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
Issue-Label Bot is automatically applying the label
bugto this issue, with a confidence of 0.54. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!Links: app homepage, dashboard and code for this bot.