' Black.
Explore posts from serversDIAdiscord.js - Imagine an app
•Created by ' Black. on 9/7/2024 in #djs-voice
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);
}
}
14 replies