Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mrgriefs/discord.js-cluster

A sharder for the Discord.js library
https://github.com/mrgriefs/discord.js-cluster

cluster clustering discord discordjs javascript manager shard sharding

Last synced: 4 days ago
JSON representation

A sharder for the Discord.js library

Awesome Lists containing this project

README

        

Discord.js Sharder


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

## Table of Contents

- [About](#about)
- [Installation](#installation)
- [Usage](#usage)
- [Documentation](#documentation)

## About

discord.js-cluster is a powerful cluster manager for the [Discord.js](https://discord.js.org/) library which implements [multiprocessing](https://en.wikipedia.org/wiki/Multicore_programming) to increase the performance of your client, heavily inspired by the Discord.js built-in [ShardingManager](https://discord.js.org/#/docs/main/stable/class/ShardingManager).
Using the Node.js [cluster](https://nodejs.org/api/cluster.html) module, Discord.js Cluster spreads all [ShardingManager](https://discord.js.org/#/docs/main/stable/class/ShardingManager)s evenly among cores, and is easy to implement!

## Installation

With npm:

```bash
$ npm install discord.js-cluster
```

With yarn:

```bash
$ yarn add discord.js-cluster
```

## Usage

Can be used exactly like the [ShardingManager](https://discord.js.org/#/docs/main/stable/class/ShardingManager)
`index.js:`

```javascript
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:`

```javascript
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](https://mrgriefs.github.io/discord.js-cluster)

You can find more documentation on the [website](https://mrgriefs.github.io/discord.js-cluster).