discord.js-cluster
v2.0.0
Published
A cluster manager for the Discord.js library
Downloads
17
Maintainers
Readme
Table of Contents
About
discord.js-cluster is a powerful cluster manager for the Discord.js library which implements multiprocessing to increase the performance of your client, heavily inspired by the Discord.js built-in ShardingManager.
Using the Node.js cluster module, Discord.js Cluster spreads all ShardingManagers evenly among cores, and is easy to implement!
Installation
With npm:
$ npm install discord.js-cluster
With yarn:
$ yarn add discord.js-cluster
Usage
Can be used exactly like the ShardingManagerindex.js:
const { ClusterManager } = require('discord.js-cluster');
const manager = new ClusterManager('./bot.js', { token: 'your-token-goes-here' });
manager.on('clusterCreate', cluster => console.log(`Launched cluster ${cluster.id}`));
manager.spawn();
bot.js:
const { Client } = require('discord.js-cluster');
const { Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
client.on('ready', () => console.log(`Cluster ${client.cluster.id} is ready!`));
client.login(); // no token is required here!
Documentation
You can find more documentation on the website.