#Getting objects from client cache after sharding
21 messages · Page 1 of 1 (latest)
• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.
discord.js and node
Depends on how you want to shard. Djs supports internal sharding (with several ws connections in the same process) that doesn’t affect how you work at all.
Traditional sharding (with several processes) needs you to get the information you need from other shards through IPC. Don‘t send full instances over that (since they get JSONified anyway) but only the data you actually need.
so is this internal ?
which one is more efficient tbh
That is traditional. Internal is only specifying shards: option in client constructor, the rest is same as unsharded bot
Depends… if your bot does heavy load stuff then seperate processes might be beneficial. If not then handling all stuff in a single process might be easier and faster
Once you need more than one server to handle the load you won‘t be able to use internal sharding anymore anyway
ok uh so is it fine if i make it traditional even though its on one host ( server )
Sure you can…
alright ty... im new to sharding
so like can u show me an example of getting the information i need from other shards through IPC
damn... complex
so if i do this... i dont have to do anything else ?
and my bot is perfectly sharded ?
It will be perfectly sharded internally, yes
But please don’t use globalThis😳 or export the client like that. Let alone both
Virtually every payload of djs has a .client property, use that in your other files
i'll do that thanks
ok
Sharding: Sending messages across shards