[Feature] Allow switching voice channels without disconnecting (external clients only) (#2866)

* eh well it should work

* fix issues

* make sure an external client is used
This commit is contained in:
Mihail Gribkov
2024-02-26 13:54:18 +03:00
committed by GitHub
parent bc5c1c523b
commit 5a62ba1af4
8 changed files with 12 additions and 10 deletions

View File

@@ -1723,14 +1723,15 @@ namespace Discord.WebSocket
{
return _audioClient?.GetInputStream(userId);
}
internal async Task<IAudioClient> ConnectAudioAsync(ulong channelId, bool selfDeaf, bool selfMute, bool external)
internal async Task<IAudioClient> ConnectAudioAsync(ulong channelId, bool selfDeaf, bool selfMute, bool external, bool disconnect = true)
{
TaskCompletionSource<AudioClient> promise;
await _audioLock.WaitAsync().ConfigureAwait(false);
try
{
await DisconnectAudioInternalAsync().ConfigureAwait(false);
if (disconnect || !external)
await DisconnectAudioInternalAsync().ConfigureAwait(false);
promise = new TaskCompletionSource<AudioClient>();
_audioConnectPromise = promise;