コード例 #1
0
 private void Stop()
 {
     participants.Clear();
     gateway.Stop();
     UnregisterClientEvents();
     session = null;
     gateway = null;
     SetProgress(VoiceGateway.ConnectionState.None);
     GC.Collect();
 }
コード例 #2
0
ファイル: VoiceConnection.cs プロジェクト: lewisc64/Driscod
        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);
        }