Skip to content

Commit

Permalink
feat: don't spam discord connects
Browse files Browse the repository at this point in the history
  • Loading branch information
N0chteil committed Jul 29, 2023
1 parent ed12dfb commit 0237d81
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/managers/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,21 @@ export class Discord {
})
.catch((err) => {
log.error("[DISCORD]", `Client login error: ${err}`);
this.connect();
log.info("[DISCORD]", "Retrying in 5 seconds...");

// Could not connect: Discord (most likely) not running
// RPC_CONNECTION_TIMEOUT: Discord (most likely) running and needs restart (most of the time)
// -> retry in 5 seconds

setTimeout(() => this.connect(), 5000);
});

this.client.on("disconnected", () => {
log.info("[DISCORD]", "Client disconnected");

this.isReady = false;

this.connect();
});

register("842112189618978897");
Expand Down

0 comments on commit 0237d81

Please sign in to comment.