fix(WebSocketShard): account code 1000 with no prior indication (#8399)

This commit is contained in:
DD
2022-07-30 21:37:46 +03:00
committed by GitHub
parent fca3dada2a
commit 5137bfc17d

View File

@@ -460,8 +460,20 @@ export class WebSocketShard extends AsyncEventEmitter<WebSocketShardEventsMap> {
private async onClose(code: number) {
switch (code) {
case 1000:
case 4200: {
case CloseCodes.Normal: {
this.debug([`Disconnected normally from code ${code}`]);
if (this.status === WebSocketShardStatus.Ready) {
return this.destroy({
code,
reason: 'Got disconnected by Discord',
recover: WebSocketShardDestroyRecovery.Reconnect,
});
}
break;
}
case CloseCodes.Resuming: {
this.debug([`Disconnected normally from code ${code}`]);
break;
}