2020-04-19 17:00:16 +00:00
|
|
|
const config = require("./config/config.ts");
|
2020-03-13 20:31:04 +00:00
|
|
|
|
|
|
|
if (config.devMode) {
|
2020-04-05 21:20:34 +00:00
|
|
|
console.log('- dev mode- ');
|
2020-03-13 20:31:04 +00:00
|
|
|
config.token = config.devToken;
|
|
|
|
config.shards = 1;
|
|
|
|
}
|
|
|
|
|
2020-04-19 17:00:16 +00:00
|
|
|
const {
|
|
|
|
ShardingManager
|
|
|
|
} = require('discord.js');
|
|
|
|
const manager = new ShardingManager('./src/bot.ts', {
|
|
|
|
token: config.token,
|
|
|
|
respawn: config.respawn,
|
|
|
|
totalShards: config.shards
|
|
|
|
});
|
2020-03-13 20:31:04 +00:00
|
|
|
|
2020-04-05 21:20:34 +00:00
|
|
|
console.log('- Launching shards -');
|
2020-03-13 20:31:04 +00:00
|
|
|
manager.spawn(config.shards, config.shardDelay, config.shardTimeout);
|
2020-04-05 21:20:34 +00:00
|
|
|
manager.on('shardCreate', shard => console.log(`- Launched shard ${shard.id} -`));
|