mirror of
https://github.com/musix-org/musix-oss
synced 2025-08-01 17:44:35 +00:00
Sharding
This commit is contained in:
15
index.js
15
index.js
@@ -1,2 +1,13 @@
|
||||
const MusicClient = require('./struct/client.js');
|
||||
const client = new MusicClient({});
|
||||
const config = require("./struct/config/config.js");
|
||||
|
||||
if (config.devMode) {
|
||||
config.token = config.devToken;
|
||||
config.shards = 1;
|
||||
}
|
||||
|
||||
const { ShardingManager } = require('discord.js');
|
||||
const manager = new ShardingManager('./bot.js', { token: config.token, respawn: true, totalShards: config.shards });
|
||||
|
||||
console.log('Launching shards...');
|
||||
manager.spawn(config.shards, config.shardDelay, config.shardTimeout);
|
||||
manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`));
|
Reference in New Issue
Block a user