player not work

try {
const VoiceConnection = joinVoiceChannel({
channelId: newState.channelId,
guildId: newState.guild.id,
adapterCreator: newState.guild.voiceAdapterCreator
});
VoiceConnection.on(VoiceConnectionStatus.Ready, async () => {
const player = createAudioPlayer();

const resource = createAudioResource(path.join(__dirname, 'support.mp3'), { inlineVolume: true });
resource.volume.setVolume(0.5);

player.play(resource);
VoiceConnection.subscribe(player);

player.on(AudioPlayerStatus.Idle, () => {
player.stop();
});
});

} catch (error) {
console.error(error);
}
}
try {
const VoiceConnection = joinVoiceChannel({
channelId: newState.channelId,
guildId: newState.guild.id,
adapterCreator: newState.guild.voiceAdapterCreator
});
VoiceConnection.on(VoiceConnectionStatus.Ready, async () => {
const player = createAudioPlayer();

const resource = createAudioResource(path.join(__dirname, 'support.mp3'), { inlineVolume: true });
resource.volume.setVolume(0.5);

player.play(resource);
VoiceConnection.subscribe(player);

player.on(AudioPlayerStatus.Idle, () => {
player.stop();
});
});

} catch (error) {
console.error(error);
}
}
10 Replies
d.js toolkit
d.js toolkitโ€ข2w ago
- What are your intents? GuildVoiceStates is required to receive voice data! - Show what dependencies you are using -- generateDependencyReport() is exported from @discordjs/voice. - Try looking at common examples: https://github.com/discordjs/voice-examples. - 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
pat
patโ€ข2w ago
then you are giving the wrong output with path.join(__dirname, "support.mp3")
Want results from more Discord servers?
Add your server