Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenAndHandle ¶
func ListenAndHandle(r ReceiverFunc, h HandlerFunc, errReporter func(err error))
ListenAndHandle loops on payloads received using the given receiver and handles them with the given handler as they arrive. If an error happens during the process, ListenAndHandle will report it using the given errReporter and return. It silently stops when the provided receiver's underlying connection is closed.
Types ¶
type HandlerFunc ¶
HandlerFunc is a function that handles a Payload.
type Payload ¶
type Payload struct { // Opcode for the payload. Op int `json:"op"` // Event data. D json.RawMessage `json:"d"` // Sequence number, used for resuming sessions // and heartbeats. Only for Opcode 0. S int64 `json:"s,omitempty"` // The event name for this payload. // Only for Opcode 0. T string `json:"t,omitempty"` }
Payload is the content of a Discord Gateway or Voice event.
type ReceiverFunc ¶
ReceiverFunc is a function that receives a single Payload.
Click to show internal directories.
Click to hide internal directories.