sharding with workers
this is my constructor, i was told that it's possible to do worker mode with internal sharding to make it more efficient, how do i do that?
version: 14.16.2
6 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!one thing, you should not sweep guild, channels and roles. It breaks functionality and is unsupported, hence the big red warning
You want to specify
mode: "worker"
in the ShardingManager options:class: ShardingManager
@14.16.3
This is a utility class that makes multi-process sharding of a bot an easy and painless experience. It works by spawning a self-contained ChildProcess or Worker for each individual shard, each containing its own instance of your bot's Client. They all have a line of communication with the master process, and there are several useful methods that utilise it in order to simplify tasks that are normally difficult with sharding. It can spawn a specific number of shards or the amount that Discord suggests for the bot, and takes a path to your main bot script to launch for each one.
:propertysignature: ClientOptions#ws @14.16.3
Options for the WebSocket
:interface: WebSocketOptions @14.16.3
So this would be correct right?:
That's all i need to modify for this to work?
Well one worker per shard is fine right? also i dont need to make another file or something, this is all?