Sharding in discord.js
This guide teaches you how to shard and deal with the different ways of doing things in discord.js. In this guide I will explain what sharding is, how to do it and the hardest part, reprogramming a non-sharded Discord bot into a sharded one, including globally executing JavaScript code and fetching all client values.
Before You Begin
Sharding should only be done when necessary, which according to the Discord API is when your bot is on 2,500 servers. So if your bot is no where near this amount, I and the entire discord.js team highly recommend not even worrying about sharding. But since it's a briefly explained topic, I'm here to help you out.
Additionally, if you are not familiar with the Discord API, specifically discord.js, it's highly recommended that you familiarize yourself with it before intending to shard.
Additional Information
If you would like to contribute to this GitBook please direct message i am toast#1213
on Discord or create a pull request on this repository.