Bot won't join Voice Channel

I use the command, and it gets stuck trying to join the voice channel.
message.channel.send(`Playing ${args[1]}`);

            var connection = joinVoiceChannel({
                guildID: message.guild.id,
                channelID: message.member.voice.channel.id,
                adapterCreator: message.guild.voiceAdapterCreator
            })

            connection.on(VoiceConnectionStatus.Ready, () => {
                console.log("Voice connection ready");
                const player = createAudioPlayer();
                connection.subscribe(player);

                const audio = createAudioResource('./music.mp3');
                player.play(audio);
            })
Was this page helpful?