Fixed LeaveVoiceServer when Multiserver is disabled
This commit is contained in:
@@ -798,10 +798,18 @@ namespace Discord
|
|||||||
CheckReady(); //checkVoice is done inside the voice client
|
CheckReady(); //checkVoice is done inside the voice client
|
||||||
if (serverId == null) throw new ArgumentNullException(nameof(serverId));
|
if (serverId == null) throw new ArgumentNullException(nameof(serverId));
|
||||||
|
|
||||||
DiscordSimpleClient client;
|
if (Config.EnableVoiceMultiserver)
|
||||||
if (_voiceClients.TryRemove(serverId, out client))
|
{
|
||||||
await client.Disconnect();
|
DiscordSimpleClient client;
|
||||||
}
|
if (_voiceClients.TryRemove(serverId, out client))
|
||||||
|
await client.Disconnect();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_dataSocket.SendLeaveVoice(serverId);
|
||||||
|
await _voiceSocket.Disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void SendInitialLog()
|
private void SendInitialLog()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -248,10 +248,15 @@ namespace Discord
|
|||||||
|
|
||||||
protected virtual async Task Cleanup()
|
protected virtual async Task Cleanup()
|
||||||
{
|
{
|
||||||
await _dataSocket.Disconnect().ConfigureAwait(false);
|
|
||||||
if (_enableVoice)
|
if (_enableVoice)
|
||||||
|
{
|
||||||
|
string voiceServerId = _voiceSocket.CurrentServerId;
|
||||||
|
if (voiceServerId != null)
|
||||||
|
_dataSocket.SendLeaveVoice(voiceServerId);
|
||||||
await _voiceSocket.Disconnect().ConfigureAwait(false);
|
await _voiceSocket.Disconnect().ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
await _dataSocket.Disconnect().ConfigureAwait(false);
|
||||||
|
|
||||||
_currentUserId = null;
|
_currentUserId = null;
|
||||||
_gateway = null;
|
_gateway = null;
|
||||||
_token = null;
|
_token = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user