Пример #1
0
 private void Stop()
 {
     participants.Clear();
     gateway.Stop();
     UnregisterClientEvents();
     session = null;
     gateway = null;
     SetProgress(VoiceGateway.ConnectionState.None);
     GC.Collect();
 }
Пример #2
0
        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);
        }