forked from Doze42/MCSS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (24 loc) · 944 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const { ShardingManager } = require('kurasuta');
const { join } = require('path');
const { Client, Intents } = require('discord.js');
const fs = require ('fs')
const config = JSON.parse(fs.readFileSync("./assets/config.json"))
global.shardCrashCount = 0;
global.botStartTime = new Date();
setInterval(function(){global.shardCrashCount = 0}, 86400000) //resets shard reconnect count daily
const sharder = new ShardingManager(join(__dirname, 'bot'), {
clusterCount: config.shardCount,
shardCount: config.shardCount,
timeout: 30000,
clientOptions: {partials: ['MESSAGE'], intents: 513},
ipcSocket: 9999
});
sharder.spawn();
sharder.on('error', (err) => {
console.log(shardCrashCount)
global.shardCrashCount++;
if (global.shardCrashCount > config.crashLimit){
console.log('Shard crash limit exceeded, exiting process')
process.exit(1)} //Kills process to avoid shard reconnection ratelimit
console.log('Sharder Error: ' + err)
});