The whole package has been rewritten to typescript to allow more type saftey and find some bugs, which will also lead to the rewrite of discord-cross-hosting
in typescript.
Naturally a major overhaul also requires some breaking changes, which have been kept small.
There could be some missing types, please report those in the Discord Server or create a issue in the repo.
npm uninstall discord-hybrid-sharding
npm install github:meister03/discord-hybrid-sharding
It is not recommended using the rewrite in production, without testing all functionalites
Imports have changed, support for cjs as well for esm is available
// Manager
- import { Manager } from 'discord-hybrid-sharding'; //esm
- const { Manager } = require('discord-hybrid-sharding'); //cjs
+ import { ClusterManager } from 'discord-hybrid-sharding'; //esm
+ const { ClusterManager } = require('discord-hybrid-sharding'); //cjs
// Cluster Client
- import { Client, data } from 'discord-hybrid-sharding';
- const { Client, data } = require('discord-hybrid-sharding');
+ import { ClusterClient, getInfo } from 'discord-hybrid-sharding';
+ const { ClusterClient, getInfo } = require('discord-hybrid-sharding');
Retreiving Cluster Data
- Cluster.Client.getInfo().TOTAL_SHARDS
- Cluster.data.TOTAL_SHARDS
+ getInfo().TOTAL_SHARDS
IPC Message System, returnType on message
, clientRequest
event
- _sCustom, _sReply, _sRequest has been removed on BaseMessage
+ _type === messageType.CUSTOM_REQUEST | messageType.CUSTOM_REPLY
Cluster Death Event additional parameter
- cluster.on('death', Child | Worker)
+ cluster.on('death', Cluster ,Child | Worker)
Cluster Spawn Event additional parameter
- cluster.on('spawn', Child | Worker)
+ cluster.on('spawn', Cluster ,Child | Worker)
Remove evalOnCluster in favor of broadcastEval , as they do the same thing
- evalOnCluster
+ broadcastEval('string'|fn, {cluster})
instead of doing
Ways of replacing
evalOnCluster