Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AudioPacket ¶
type AudioPacket struct { Type uint8 Version uint8 Sequence uint16 Timestamp uint32 SSRC uint32 Opus []byte }
AudioPacket is a parsed and decrypted RTP frame containing Opus encoded audio.
type Connection ¶
type Connection struct { // Send is used to send Opus encoded audio packets. Send chan []byte // Recv is used to receive audio packets // containing Opus encoded audio data. Recv chan *AudioPacket // contains filtered or unexported fields }
Connection represents a Discord voice connection.
func EstablishNewConnection ¶
func EstablishNewConnection(ctx context.Context, state *StateUpdate, server *ServerUpdate, opts ...ConnectionOption) (*Connection, error)
EstablishNewConnection establishes a new voice connection with the provided information. This connection should be closed by calling its Close method when no longer needed.
func (*Connection) Logger ¶
func (vc *Connection) Logger() log.Logger
Logger is here to make the logger available to third party packages that need to report errors related to this voice connection.
type ConnectionOption ¶
type ConnectionOption func(*Connection)
ConnectionOption is a function that configures a Connection. It is used in EstablishNewConnection.
func WithLogger ¶
func WithLogger(l log.Logger) ConnectionOption
WithLogger can be used to set the logger used by this connection. Defaults to a standard logger reporting only errors. See the log package for more information about logging with Harmony.
type ServerUpdate ¶
type ServerUpdate struct { Token string `json:"token"` GuildID string `json:"guild_id"` Endpoint string `json:"endpoint"` }
ServerUpdate is the payload describing the update of a voice server.
type State ¶
type State struct { GuildID string `json:"guild_id"` ChannelID *string `json:"channel_id"` UserID string `json:"user_id"` SessionID string `json:"session_id"` Deaf bool `json:"deaf"` Mute bool `json:"mute"` SelfDeaf bool `json:"self_deaf"` SelfMute bool `json:"self_mute"` SelfStream bool `json:"self_stream"` Suppress bool `json:"suppress"` // Whether this user is muted by the current user. }
State represents the voice state of a user.
type StateUpdate ¶
type StateUpdate struct {
State
}
StateUpdate is the payload describing the update of the voice state of a user.