github.com/diamondburned/arikawa@v1.3.14/voice/voicegateway/events.go (about) 1 package voicegateway 2 3 import ( 4 "strconv" 5 6 "github.com/diamondburned/arikawa/discord" 7 ) 8 9 // OPCode 2 10 // https://discordapp.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection-example-voice-ready-payload 11 type ReadyEvent struct { 12 SSRC uint32 `json:"ssrc"` 13 IP string `json:"ip"` 14 Port int `json:"port"` 15 Modes []string `json:"modes"` 16 Experiments []string `json:"experiments"` 17 18 // From Discord's API Docs: 19 // 20 // `heartbeat_interval` here is an erroneous field and should be ignored. 21 // The correct `heartbeat_interval` value comes from the Hello payload. 22 23 // HeartbeatInterval discord.Milliseconds `json:"heartbeat_interval"` 24 } 25 26 func (r ReadyEvent) Addr() string { 27 return r.IP + ":" + strconv.Itoa(r.Port) 28 } 29 30 // OPCode 4 31 // https://discordapp.com/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection-example-session-description-payload 32 type SessionDescriptionEvent struct { 33 Mode string `json:"mode"` 34 SecretKey [32]byte `json:"secret_key"` 35 } 36 37 // OPCode 5 38 type SpeakingEvent SpeakingData 39 40 // OPCode 6 41 // https://discordapp.com/developers/docs/topics/voice-connections#heartbeating-example-heartbeat-ack-payload 42 type HeartbeatACKEvent uint64 43 44 // OPCode 8 45 // https://discordapp.com/developers/docs/topics/voice-connections#heartbeating-example-hello-payload-since-v3 46 type HelloEvent struct { 47 HeartbeatInterval discord.Milliseconds `json:"heartbeat_interval"` 48 } 49 50 // OPCode 9 51 // https://discordapp.com/developers/docs/topics/voice-connections#resuming-voice-connection-example-resumed-payload 52 type ResumedEvent struct{}