#bot goes into playing state but doesnt actually play the audio

13 messages · Page 1 of 1 (latest)

rapid belfry
#

`function playSound(interaction) {
console.log(interaction.options.getString('sound'))
// console.log(interaction.member.voice.channelId)
let voiceChannel = interaction.member.voice.channelId;
if(!voiceChannel) {
interaction.reply("Join a channel first!");
return;
}
const connection = joinVoiceChannel({
channelId: interaction.member.voice.channelId,
guildId: interaction.guild.id,
adapterCreator: interaction.guild.voiceAdapterCreator,
});
// connect
// play
// leave
const player = createAudioPlayer();

const resource = createAudioResource('vineboom.mp3');
connection.subscribe(player);
player.play(resource);
player.on(AudioPlayerStatus.Idle, () => {
    console.log('idle1');
});
player.on(AudioPlayerStatus.Playing, () => {
    console.log('playing');
});
// console.log(interaction.guild.voiceAdapterCreator)
// setTimeout(destroyConnection,3000)
// function destroyConnection() {
//     connection.destroy();
// }

}`

radiant beaconBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

rapid belfry
dense ridge
#

try passing the current file path using ./

rapid belfry
#

No luck

#

playing
playing
idle1

#

it gives the playing state twice interestingly

#

thats my file tree

#

The audio is only 1 second long

#

could that be an issue? ill try a longer one

#

@dense ridge

pale kite
#

fs paths are relative to your cwd you start node from. So the path to that file would probably be something like ./src/commands/test/vineboom.mp3