1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-01-05 03:37:08 +00:00

gateway: Allow custom SessionID

This commit is contained in:
diamondburned 2021-06-14 13:56:25 -07:00
parent 482e4338eb
commit b6a4266438

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