CRBT-Team / Purplet

A framework for quickly building Discord bots + more packages relating to the Discord API, with a primary goal on a rich developer experience.
https://purplet.js.org
Apache License 2.0
64 stars 1 forks source link

Shard Management #58

Open paperdave opened 2 years ago

paperdave commented 2 years ago

currently, there is no system in place for shards: calculating them, and also spawning them. we should do this through the /gateway/bot route, but it should also have some API to allow user defined behavior with this when you intend to run on multiple threads/instances/computers. (edit, Gateway supports a shard property but this is only for one instance and you must manually spawn multiple instances of it)

idk the proper API for this or the exact implementation of a shard manager, and would like some feedback frol others. one idea I have is a simple property/env with a machine id+total count can be given, then each instance of the shard manager would equally login with the specified shards (aka the same system actual shards use but abstracted). I'll have to look into existing systems for how it works.