gateway: Allow custom SessionID

This commit is contained in:
diamondburned 2021-06-14 13:56:25 -07:00
parent 482e4338eb
commit b6a4266438
1 changed files with 8 additions and 0 deletions

View File

@ -278,6 +278,14 @@ func (g *Gateway) SessionID() string {
return g.sessionID
}
// UseSessionID overrides the internal session ID for the one the user provides.
func (g *Gateway) UseSessionID(sessionID string) {
g.sessionMu.Lock()
defer g.sessionMu.Unlock()
g.sessionID = sessionID
}
// OnShardingRequired sets the function to be called if Discord closes with
// error code 4011 aka Sharding Required. When called, the Gateway will already
// be closed, and can (after increasing the number of shards) be reopened using