[SOLVED] 🤦Bot doesnt join the voice channel

So I have the following code, when its being executed, the bot doesnt join the voice channel.

const { joinVoiceChannel, createAudioPlayer, createAudioResource, StreamType } = require("@discordjs/voice")
const { join } = require("node:path")

module.exports.run = async (message, client) => {

    const resource = createAudioResource(join(__dirname, "pregame.wav"), {
        inputType: StreamType.WebmOpus
    })

    const connection = joinVoiceChannel({
        channelId: client.channelId,
        guildId: message.guild.id,
        adapterCreator: message.guild.voiceAdapterCreator
    })

    const player = createAudioPlayer()

    player.play(resource)
    connection.subscribe(player)

}


client.channelId is defined in the main file as a channel ID.

Am i doing something wrong? There are no errors in the console and the file is being ran (ive added console.logs to see if it works and it does).

Idk if its an intent issue but here are my intents:
const intents = [GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildMessages]
Was this page helpful?