joinVoiceChannel is not a function. But its in dependencies

This is there error I get
awash@awash-hp:~/Documents/code/JS/musicBot$ bun run index.js
Ready! Logged in as Player#9475
[awashcard0]: !play
94 |
95 | if (connection) {
96 | connection.destroy();
97 | }
98 |
99 | connection = joinVoiceChannel({
^
TypeError: joinVoiceChannel is not a function. (In 'joinVoiceChannel({
channelId: voiceChannel.id,
guildId: voiceChannel.guild.id,
adapterCreator: voiceChannel.guild.voiceAdapterCreator
})', 'joinVoiceChannel' is undefined)
at /home/awash/Documents/code/JS/musicBot/index.js:99:18
at playAudio (/home/awash/Documents/code/JS/musicBot/index.js:88:26)
at /home/awash/Documents/code/JS/musicBot/index.js:73:17
awash@awash-hp:~/Documents/code/JS/musicBot$
awash@awash-hp:~/Documents/code/JS/musicBot$ bun run index.js
Ready! Logged in as Player#9475
[awashcard0]: !play
94 |
95 | if (connection) {
96 | connection.destroy();
97 | }
98 |
99 | connection = joinVoiceChannel({
^
TypeError: joinVoiceChannel is not a function. (In 'joinVoiceChannel({
channelId: voiceChannel.id,
guildId: voiceChannel.guild.id,
adapterCreator: voiceChannel.guild.voiceAdapterCreator
})', 'joinVoiceChannel' is undefined)
at /home/awash/Documents/code/JS/musicBot/index.js:99:18
at playAudio (/home/awash/Documents/code/JS/musicBot/index.js:88:26)
at /home/awash/Documents/code/JS/musicBot/index.js:73:17
awash@awash-hp:~/Documents/code/JS/musicBot$
Its says that TypeError: joinVoiceChannel is not a function but its in my require at const { Client, Collection, Events, GatewayIntentBits, createAudioResource, createAudioPlayer, AudioPlayerStatus, joinVoiceChannel, StreamType } = require('discord.js'); discord.js@14.15.2 bun: 1.1.4 (I cant get node to work)
3 Replies
d.js toolkit
d.js toolkit2mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
duck
duck2mo ago
discord.js does not reexport @discordjs/voice since it's an entirely optional submodule you'd need to import from @discordjs/voice directly (on the assumption you've installed it)
Awashcard0
Awashcard02mo ago
Thank you, I need some sleep.