feature: track node load, account for this when selecting a node

This commit is contained in:
Christopher F
2018-08-23 18:29:58 -04:00
parent 35bfb14058
commit d3a75d1dab
3 changed files with 38 additions and 20 deletions

View File

@ -62,27 +62,29 @@ const (
opDestroy = "destroy"
opPlayerUpdate = "playerUpdate"
opEvent = "event"
opStats = "stats"
eventTrackEnd = "TrackEndEvent"
eventTrackException = "TrackExceptionEvent"
eventTrackStuck = "TrackStuckEvent"
)
type message struct {
Op string `json:"op"`
GuildID string `json:"guildId,omitempty"`
SessionID string `json:"sessionId,omitempty"`
Event *VoiceServerUpdate `json:"event,omitempty"`
Track string `json:"track,omitempty"`
StartTime string `json:"startTime,omitempty"`
EndTime string `json:"endTime,omitempty"`
Pause bool `json:"pause,omitempty"`
Position int `json:"position,omitempty"`
Volume int `json:"volume,omitempty"`
State *state `json:"state,omitempty"`
Type string `json:"type,omitempty"`
Reason string `json:"reason,omitempty"`
Error string `json:"error,omitempty"`
ThresholdMs int `json:"thresholdMs,omitempty"`
Op string `json:"op"`
GuildID string `json:"guildId,omitempty"`
SessionID string `json:"sessionId,omitempty"`
Event VoiceServerUpdate `json:"event,omitempty"`
Track string `json:"track,omitempty"`
StartTime string `json:"startTime,omitempty"`
EndTime string `json:"endTime,omitempty"`
Pause bool `json:"pause,omitempty"`
Position int `json:"position,omitempty"`
Volume int `json:"volume,omitempty"`
State state `json:"state,omitempty"`
Type string `json:"type,omitempty"`
Reason string `json:"reason,omitempty"`
Error string `json:"error,omitempty"`
ThresholdMs int `json:"thresholdMs,omitempty"`
StatCPU statCPU `json:"cpu,omitempty"`
// TODO: stats
}
@ -91,6 +93,10 @@ type state struct {
Position int `json:"position"`
}
type statCPU struct {
Load float32 `json:"lavalinkLoad"`
}
// VoiceServerUpdate is a raw Discord VOICE_SERVER_UPDATE event
type VoiceServerUpdate struct {
GuildID string `json:"guild_id"`