pass variables into <ShardClientUtil>.broadcastEval()
I've got the following code:
how would i modify the function to include var commandName inside of broadcastEval() ?
3 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!By passing a context option as second parameter with your variable and then referencing that.
https://discordjs.dev/docs/packages/discord.js/14.15.3/ShardClientUtil:Class#broadcastEval (overload 3)
:guide: Sharding: Additional information - Eval arguments
The context option only accepts properties which are JSON-serializable. This means you cannot pass complex data types in the context directly. For example, if you sent a User instance, the function would receive the raw data object.
read more