Skip to content

Commit

Permalink
gracefully shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
phenylshima committed Nov 20, 2023
1 parent 3442214 commit 8bad2d1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ client.once(Events.ClientReady, async (client) => {
await client.application.commands.set([join.definition, leave.definition]);
});

process.on("SIGINT", () => process.exit(0));
process.on("SIGTERM", () => process.exit(0));
function shutdown() {
void client.destroy().then(() => process.exit(0));
}

process.on("SIGINT", shutdown);
process.on("SIGTERM", shutdown);

void client.login();

0 comments on commit 8bad2d1

Please sign in to comment.