Skip to content

MrGriefs/discord.js-cluster

Repository files navigation

Discord.js Sharder

Patreon Discord Travis (.com) David node-current GitHub package.json version RunKit

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 ShardingManager
index.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!

You can find more documentation on the website.