From afab84009be89bd6e793dafea88a6acd89f34df9 Mon Sep 17 00:00:00 2001 From: Fedor Lapshin Date: Mon, 24 Oct 2022 02:03:26 +0300 Subject: [PATCH] Add missing fields to Ready (#1227) * feat(Ready): add shard and application fields Add missing Shard and Application fields to Ready event struct. * feat(Ready): make Shard pointer Make Shard field pointer to be consistent with the API. --- events.go | 14 +++++++------- state.go | 8 +++++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/events.go b/events.go index e5d83b9..890df22 100644 --- a/events.go +++ b/events.go @@ -36,13 +36,13 @@ type Event struct { // A Ready stores all data for the websocket READY event. type Ready struct { - Version int `json:"v"` - SessionID string `json:"session_id"` - User *User `json:"user"` - Guilds []*Guild `json:"guilds"` - PrivateChannels []*Channel `json:"private_channels"` - - // TODO: Application and Shard + Version int `json:"v"` + SessionID string `json:"session_id"` + User *User `json:"user"` + Shard *[2]int `json:"shard"` + Application *Application `json:"application"` + Guilds []*Guild `json:"guilds"` + PrivateChannels []*Channel `json:"private_channels"` } // ChannelCreate is the data for a ChannelCreate event. diff --git a/state.go b/state.go index f790ccb..f7bd6b7 100644 --- a/state.go +++ b/state.go @@ -909,9 +909,11 @@ func (s *State) onReady(se *Session, r *Ready) (err error) { // if state is disabled, store the bare essentials. if !se.StateEnabled { ready := Ready{ - Version: r.Version, - SessionID: r.SessionID, - User: r.User, + Version: r.Version, + SessionID: r.SessionID, + User: r.User, + Shard: r.Shard, + Application: r.Application, } s.Ready = ready