Инот
Инот
DIAdiscord.js - Imagine an app
Created by Инот on 12/11/2023 in #djs-voice
redirection voice from one channel of guild to another channel in another guild
My code now:
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);

})
But i have a one bug: If 2 or more peoples speaking at one time bot sending packets only from one people or bot voice have some lags and send mixed voice how fix it?
5 replies