I have a discord bot that I'm trying to get to join a voice channel and have it repeat a sound file, so far I have got it to join but after it joins, none of the code in the arrow function is run
let channel = client.channels.cache.get('723620872572895243')
channel.join(connection => {
console.log("Starting")
mp3("speech.mp3", function (err, duration) {
if (err) return console.log(err);
console.log("File duration:" + duration * 1000 + "ms")
repeat(connection, duration)
})
}).catch(console.error)
This is the code I'm trying to run but it joins the channel and nothing after the arrow function is run
Here is the repeat() function in case it is needed
function repeat(connection, duration) {
const dispatcher = connection.play("speech.mp3")
let play = setInterval(function () {
const dispatcher = connection.play("speech.mp3")
console.log("Playing")
}, duration * 1000 + 2000)
module.exports.interval = play
}