private void Stop() { participants.Clear(); gateway.Stop(); UnregisterClientEvents(); session = null; gateway = null; SetProgress(VoiceGateway.ConnectionState.None); GC.Collect(); }
public Task Disconnect() { if (Guild == null) { Logger.Warn("Attempted to disconnect a voice connection, but was unable to locate the guild. Assuming connection has already closed."); return(Task.CompletedTask); } lock (Guild.VoiceLock) { if (VoiceGateway != null && VoiceGateway.Running) { VoiceGateway.Stop().Wait(); } if (Guild.VoiceConnection == this) { Guild.VoiceConnection = null; } } return(Task.CompletedTask); }