Skip to content
This repository was archived by the owner on Mar 5, 2023. It is now read-only.

Commit afab840

Browse files
authored
Add missing fields to Ready (bwmarrin#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.
1 parent 0c2b0ec commit afab840

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

events.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ type Event struct {
3636

3737
// A Ready stores all data for the websocket READY event.
3838
type Ready struct {
39-
Version int `json:"v"`
40-
SessionID string `json:"session_id"`
41-
User *User `json:"user"`
42-
Guilds []*Guild `json:"guilds"`
43-
PrivateChannels []*Channel `json:"private_channels"`
44-
45-
// TODO: Application and Shard
39+
Version int `json:"v"`
40+
SessionID string `json:"session_id"`
41+
User *User `json:"user"`
42+
Shard *[2]int `json:"shard"`
43+
Application *Application `json:"application"`
44+
Guilds []*Guild `json:"guilds"`
45+
PrivateChannels []*Channel `json:"private_channels"`
4646
}
4747

4848
// ChannelCreate is the data for a ChannelCreate event.

state.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -909,9 +909,11 @@ func (s *State) onReady(se *Session, r *Ready) (err error) {
909909
// if state is disabled, store the bare essentials.
910910
if !se.StateEnabled {
911911
ready := Ready{
912-
Version: r.Version,
913-
SessionID: r.SessionID,
914-
User: r.User,
912+
Version: r.Version,
913+
SessionID: r.SessionID,
914+
User: r.User,
915+
Shard: r.Shard,
916+
Application: r.Application,
915917
}
916918

917919
s.Ready = ready

0 commit comments

Comments
 (0)