Hi, I'm still learning how to code so please bear with me. As the title reads, I'm having issues with a custom bot. It joins the voice channel when i provide a prefix and link but doesn't play the music, instead it sits idle and pops this error message in my terminal;
TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object
This is most of the coding for it;
``function play(connection, message){
var server = servers[message.guild.id];
server.dispatcher = connection.playStream(ytdl(server.queue[0], {filter: "audioonly"}));
server.queue.shift();
server.dispatcher.on("end", function(){
if(server.queue[0]){
play(connection, message);
}else {
connection.disconnect();
}
});
}
if(!args[1]){
message.channel.send("You need to provide a link!");
return;
}
if(!message.member.voiceChannel){
message.channel.send("You must be in a channel to play the bot!");
return;
}
if(!servers[message.guild.id]) servers[message.guild.id] = {
queue: []
}
var server = servers[message.guild.id];
server.queue.push(args[1]);
if(!message.guild.voiceConnection) message.member.voiceChannel.join().then(function(connection){
play(connection, message);
})
break;
Hi, I'm still learning how to code so please bear with me. As the title reads, I'm having issues with a custom bot. It joins the voice channel when i provide a prefix and link but doesn't play the music, instead it sits idle and pops this error message in my terminal;
TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object
This is most of the coding for it; ``function play(connection, message){ var server = servers[message.guild.id];
I am also using ytdl-core as a module for it