const connection = voiceData.connection;
const channel = message.member.voice.channel
const voice = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator
});
voiceData.listener = voice;
const receiver = connection.receiver;
const speaking = receiver.speaking;
speaking.on('start', (userId) => {
const player = createAudioPlayer({
behaviors: {
noSubscriber: NoSubscriberBehavior.Pause
}
});
const stream = receiver.subscribe(userId);
const resource = createAudioResource(stream, { inputType: StreamType.Opus });
player.play(resource);
voice.subscribe(player);
})
const connection = voiceData.connection;
const channel = message.member.voice.channel
const voice = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator
});
voiceData.listener = voice;
const receiver = connection.receiver;
const speaking = receiver.speaking;
speaking.on('start', (userId) => {
const player = createAudioPlayer({
behaviors: {
noSubscriber: NoSubscriberBehavior.Pause
}
});
const stream = receiver.subscribe(userId);
const resource = createAudioResource(stream, { inputType: StreamType.Opus });
player.play(resource);
voice.subscribe(player);
})