1.0.1 • Published 3 years ago

discord-sharding v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Table of Contents

About

Discord-Sharding-Cluster is a fork of Eris Sharder, proposing a powerful sharding manager for the Discord.js library, using Node.js's cluster module to spread shards evenly among all cores. All features are on-par with Eris Sharder, anything that gets added to Eris Sharder will get added here too.

Installation

With npm:

$ npm install discord-sharding
$ pnpm install discord-sharding

Usage

In index.js:

const { ShardingCluster } = require('discord-sharding');

const manager = new ShardingCluster('./src/bot.js', { token: 'your-token-goes-here' });

manager.on('clusterCreate', cluster => console.log(`Launched cluster ${cluster.id}`));

manager.spawn();

In bot.js

const { Client } = require('discord-sharding');
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!