Revert "Add sharding support"
This commit is contained in:
parent
7922e71d1e
commit
cb6b3b956e
2 changed files with 1 additions and 19 deletions
|
@ -38,10 +38,6 @@ type Session struct {
|
||||||
// Should the session request compressed websocket data.
|
// Should the session request compressed websocket data.
|
||||||
Compress bool
|
Compress bool
|
||||||
|
|
||||||
// Sharding
|
|
||||||
ShardID int
|
|
||||||
NumShards int
|
|
||||||
|
|
||||||
// Should state tracking be enabled.
|
// Should state tracking be enabled.
|
||||||
// State tracking is the best way for getting the the users
|
// State tracking is the best way for getting the the users
|
||||||
// active guilds and the members of the guilds.
|
// active guilds and the members of the guilds.
|
||||||
|
|
16
wsapi.go
16
wsapi.go
|
@ -40,7 +40,6 @@ type handshakeData struct {
|
||||||
Properties handshakeProperties `json:"properties"`
|
Properties handshakeProperties `json:"properties"`
|
||||||
LargeThreshold int `json:"large_threshold"`
|
LargeThreshold int `json:"large_threshold"`
|
||||||
Compress bool `json:"compress"`
|
Compress bool `json:"compress"`
|
||||||
Shard [2]int `json:"shard"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type handshakeOp struct {
|
type handshakeOp struct {
|
||||||
|
@ -80,20 +79,7 @@ func (s *Session) Open() (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
handshake := handshakeData{
|
err = s.wsConn.WriteJSON(handshakeOp{2, handshakeData{3, s.Token, handshakeProperties{runtime.GOOS, "Discordgo v" + VERSION, "", "", ""}, 250, s.Compress}})
|
||||||
Version: 4,
|
|
||||||
Token: s.Token,
|
|
||||||
Properties: handshakeProperties{runtime.GOOS, "Discordgo v" + VERSION, "", "", ""},
|
|
||||||
LargeThreshold: 250,
|
|
||||||
Compress: s.Compress,
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we've set NumShards, add the shard information to the handshake
|
|
||||||
if s.NumShards > 0 {
|
|
||||||
handshake.Shard = [2]int{s.ShardID, s.NumShards}
|
|
||||||
}
|
|
||||||
|
|
||||||
err = s.wsConn.WriteJSON(handshakeOp{2, handshake})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue