Skip to content

Commit

Permalink
feat: add cpr
Browse files Browse the repository at this point in the history
  • Loading branch information
tresabhi committed Dec 16, 2024
1 parent d9aca6a commit e296267
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/bot/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,19 @@ import { manager } from './core/discord/manager';

console.log('pre manager event listeners and spawn');

let isFirst = true;
const interval = setInterval(() => {
if (!isFirst) {
console.warn('respawning all shards because manager died');
manager.respawnAll();
}

isFirst = false;
}, 5000);

const shards = await manager
.on('shardCreate', (shard) => {
clearInterval(interval);
console.log(`🟡 Launching shard ${shard.id}`);
shard.on('ready', () => console.log(`🟢 Launched shard ${shard.id}`));
})
Expand Down

0 comments on commit e296267

Please sign in to comment.