Moving things around..
This commit is contained in:
parent
b1ac010731
commit
9648705e77
1 changed files with 21 additions and 21 deletions
42
voice.go
42
voice.go
|
@ -91,27 +91,6 @@ func (v *VoiceConnection) Speaking(b bool) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
// WaitUntilConnected waits for the Voice Connection to
|
||||
// become ready, if it does not become ready it retuns an err
|
||||
func (v *VoiceConnection) waitUntilConnected() error {
|
||||
|
||||
i := 0
|
||||
for {
|
||||
if v.Ready {
|
||||
return nil
|
||||
}
|
||||
|
||||
if i > 10 {
|
||||
return fmt.Errorf("Timeout waiting for voice.")
|
||||
}
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
i++
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ChangeChannel sends Discord a request to change channels within a Guild
|
||||
// !!! NOTE !!! This function may be removed in favour of just using ChannelVoiceJoin
|
||||
func (v *VoiceConnection) ChangeChannel(channelID string, mute, deaf bool) (err error) {
|
||||
|
@ -192,6 +171,27 @@ type voiceOP2 struct {
|
|||
HeartbeatInterval time.Duration `json:"heartbeat_interval"`
|
||||
}
|
||||
|
||||
// WaitUntilConnected waits for the Voice Connection to
|
||||
// become ready, if it does not become ready it retuns an err
|
||||
func (v *VoiceConnection) waitUntilConnected() error {
|
||||
|
||||
i := 0
|
||||
for {
|
||||
if v.Ready {
|
||||
return nil
|
||||
}
|
||||
|
||||
if i > 10 {
|
||||
return fmt.Errorf("Timeout waiting for voice.")
|
||||
}
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
i++
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Open opens a voice connection. This should be called
|
||||
// after VoiceChannelJoin is used and the data VOICE websocket events
|
||||
// are captured.
|
||||
|
|
Loading…
Reference in a new issue