소스 검색

Handle VOICE_SERVER_UPDATE better, closes #115

Bruce Marriner 9 년 전
부모
커밋
eec0faa7b3
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      wsapi.go

+ 4 - 0
wsapi.go

@@ -466,6 +466,10 @@ func (s *Session) onVoiceServerUpdate(se *Session, st *VoiceServerUpdate) {
 	s.Voice.endpoint = st.Endpoint
 	s.Voice.guildID = st.GuildID
 
+	// If currently connected to voice ws/udp, then disconnect.
+	// Has no effect if not connected.
+	s.Voice.Close()
+
 	// We now have enough information to open a voice websocket conenction
 	// so, that's what the next call does.
 	err := s.Voice.Open()