I asked for help some days ago but no good answers, so, I’m trying again, hoping someone will explain where I did wrong and how to solve it.
So, this is my JS code, I’m new to JS so my code will not be perfect.
if (!message.member.voice.channel) {
return
} else if (message.member.voice.channel) {
const connection = joinVoiceChannel({
channelId: message.member.voice.channel.id,
guildId: message.guild.id,
adapterCreator: message.guild.voiceAdapterCreator
});
const player = createAudioPlayer();
const resource = createAudioResource('./music/song.mp3');
//play the song resource
player.play(resource);
connection.subscribe(player);
}
Everything works fine, the bot joins the voice channel, no errors in the console BUT it doesn’t play the audio file
--------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.7.4
- prism-media: 1.3.2
Opus Libraries
- @discordjs/opus: 0.5.3
- opusscript: not found
Encryption Libraries
- sodium: not found
- libsodium-wrappers: 0.7.9
- tweetnacl: not found
FFmpeg
- version: 4.4.1-essentials_build-www.gyan.dev
- libopus: yes
--------------------------------------------------
This is the console output when I use generateDependenciesReport() so I think everything’s okay.
Can someone explain me why my bot is not playing music but it joins voice channel without any problem ? Thanks a lot