mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-01-08 04:57:31 +00:00
gateway: Allow custom SessionID
This commit is contained in:
parent
482e4338eb
commit
b6a4266438
|
@ -278,6 +278,14 @@ func (g *Gateway) SessionID() string {
|
||||||
return g.sessionID
|
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
|
// OnShardingRequired sets the function to be called if Discord closes with
|
||||||
// error code 4011 aka Sharding Required. When called, the Gateway will already
|
// 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
|
// be closed, and can (after increasing the number of shards) be reopened using
|
||||||
|
|
Loading…
Reference in a new issue