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 toolkit3mo 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
' Black.
' Black.OP3mo ago
no ,_, Issue solved? 😀
' Black.
' Black.OP3mo ago
No description
' Black.
' Black.OP3mo ago
if url it work without problems
pat
pat3mo ago
then you are giving the wrong output with path.join(__dirname, "support.mp3")
' Black.
' Black.OP3mo ago
k same
' Black.
' Black.OP3mo ago
No description
' Black.
' Black.OP3mo ago
uh wait
' Black.
' Black.OP3mo ago
No description
' Black.
' Black.OP3mo ago
fixed
Want results from more Discord servers?
Add your server