Skip to content

Commit

Permalink
Add missing fields to Ready (#1227)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
FedorLap2006 authored Oct 23, 2022
1 parent 0c2b0ec commit afab840
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
14 changes: 7 additions & 7 deletions events.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 5 additions & 3 deletions state.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit afab840

Please sign in to comment.