#Pass variables into <ShardingManager>.broadcastEval

4 messages · Page 1 of 1 (latest)

inland tree
#

I have this code:

const params = {
  guild_id: "",
  channel_id: "",
  shard_id: 0
}

// @ts-ignore
const result = await manager.broadcastEval(async (client: CustomClient) => {
  const guild = client.guilds.cache.get(params.guild_id)
  const channel = guild?.channels.cache.get(params.channel_id);

  return channel?.id

}, { shard: params.shard_id });

console.log(result);

But i get the following error when i run this code:

Error [ReferenceError]: msg is not defined
    at eval (eval at _eval (/media/cleiton/Arquivos/Pastas/Documentos/Projetos/bot/api/node_modules/discord.js/src/client/Client.js:482:12), <anonymous>:2:55)

So i want to know... How can i pass the variable params to the broadcastEval? With the vanilla javascript eval i can pass the variables into strings, but how can i do in shardingManager?

shy burrowBOT
#

• 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.

inland tree
#

i read the docs searching for somethind, and i find the context option, but how can i read that?