Gateway: Fixed Invalid Session retrying forever bug

This commit is contained in:
diamondburned (Forefront) 2020-04-22 14:45:19 -07:00
parent 536018b5f8
commit a2a1ccd01e
1 changed files with 6 additions and 2 deletions

View File

@ -151,8 +151,12 @@ func HandleOP(g *Gateway, op *OP) error {
// Discord expects us to sleep for no reason
time.Sleep(time.Duration(rand.Intn(5)+1) * time.Second)
// Invalid session, respond with Identify.
return g.Identify()
// Invalid session, try and Identify.
if err := g.Identify(); err != nil {
// Can't identify, reconnect.
go g.Reconnect()
}
return nil
case HelloOP:
// What is this OP doing here???