Example #1
0
        protected virtual async Task Cleanup()
        {
            if (_config.EnableVoice)
            {
                string voiceServerId = _voiceSocket.CurrentServerId;
                if (voiceServerId != null)
                {
                    _dataSocket.SendLeaveVoice(voiceServerId);
                }
                await _voiceSocket.Disconnect().ConfigureAwait(false);
            }
            await _dataSocket.Disconnect().ConfigureAwait(false);

            _userId  = null;
            _gateway = null;
            _token   = null;
        }