Why isn't the bot playing the audio

I'm using this code from the guide and the bot is joining the channel, but not playing any audio. How could I fix this? Here's my code:
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: interaction.guildId,
adapterCreator: channel.guild.voiceAdapterCreator,
selfDeaf: false
});
const player = createAudioPlayer({
behaviors: {noSubscriber: NoSubscriberBehavior.Pause},
});
connection.subscribe(player)
const resource = createAudioResource('music/Steps.mp3', { metadata: {channel: channel} });
player.play(resource);
interaction.editReply(`Playing ${channel.toString()}`)
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: interaction.guildId,
adapterCreator: channel.guild.voiceAdapterCreator,
selfDeaf: false
});
const player = createAudioPlayer({
behaviors: {noSubscriber: NoSubscriberBehavior.Pause},
});
connection.subscribe(player)
const resource = createAudioResource('music/Steps.mp3', { metadata: {channel: channel} });
player.play(resource);
interaction.editReply(`Playing ${channel.toString()}`)
I'm also not getting any errors
3 Replies
Bouns
Bouns3y ago
Verify if your link of your music is correct if it's ok check with external link: https://cdn.discordapp.com/attachments/806282416364585062/999273104041840680/testMusic.mp3 and add this line to see what is the actual state:
player.once('stateChange', (oldState, newState) => {
console.log("oldState: ", oldState.status, " | ", "NewState: ", newState.status)
}
player.once('stateChange', (oldState, newState) => {
console.log("oldState: ", oldState.status, " | ", "NewState: ", newState.status)
}
CanineData
CanineDataOP3y ago
I fixed it myself, turned out I had forgotten one of the dependencies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server