Discord.js bot joining voice channel but wont run the remaining code after joining

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 => {
    mp3("speech.mp3", function (err, duration) {
        if (err) return console.log(err);
        console.log("File duration:" + duration * 1000 + "ms")
        repeat(connection, duration)

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")
}, duration * 1000 + 2000)
module.exports.interval = play

209 thoughts on “Discord.js bot joining voice channel but wont run the remaining code after joining”

  1. Great work! That is the kind of information that are supposed to
    be shared around the web. Shame on Google for not positioning this submit higher!
    Come on over and talk over with my website . Thanks =)

  2. Hello! Someone in my Myspace group shared this website with us so I came
    to give it a look. I’m definitely loving the information. I’m
    book-marking and will be tweeting this to my followers!
    Outstanding blog and great design.

  3. My brother suggested I would possibly like this web site.
    He used to be totally right. This publish truly made my day.
    You can not believe just how a lot time I had spent for this information! Thank you!

  4. An outstanding share! I’ve just forwarded this onto a friend
    who was doing a little research on this. And he in fact ordered me
    lunch because I found it for him… lol.
    So allow me to reword this…. Thank YOU for the meal!!
    But yeah, thanx for spending time to discuss this topic here on your website.

  5. Hello my loved one! I want to say that this post is
    amazing, great written and include approximately all significant
    infos. I’d like to look extra posts like this .

  6. A motivating discussion is worth comment.
    I do believe that you ought to write more about this topic,
    it might not be a taboo matter but usually people
    don’t speak about such topics. To the next! Kind regards!!

  7. It’s appropriate time to make some plans for the future
    and it is time to be happy. I’ve read this post and
    if I could I desire to suggest you some interesting things or tips.
    Perhaps you can write next articles referring to this article.
    I wish to read even more things about it! quest bars http://j.mp/3jZgEA2 quest

  8. Pingback: gay on line dating

Leave a Comment