mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
Add shard eval, broadcastEval, and fix fetchGuildCount response
This commit is contained in:
@@ -114,6 +114,17 @@ class ShardingManager extends EventEmitter {
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates a script on all shards, in the context of the Clients.
|
||||
* @param {string} script JavaScript to run on each shard
|
||||
* @returns {Promise<Array>} Results of the script
|
||||
*/
|
||||
broadcastEval(script) {
|
||||
const promises = [];
|
||||
for (const shard of this.shards.values()) promises.push(shard.eval(script));
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the total guild count across all shards.
|
||||
* @param {number} [timeout=3000] Time to automatically fail after (in milliseconds)
|
||||
|
||||
Reference in New Issue
Block a user