diff --git a/packages/discord.js/src/sharding/Shard.js b/packages/discord.js/src/sharding/Shard.js index e7d2bea43ab7..d0bccf09d6c4 100644 --- a/packages/discord.js/src/sharding/Shard.js +++ b/packages/discord.js/src/sharding/Shard.js @@ -367,6 +367,12 @@ class Shard extends EventEmitter { return; } + // Shard has resumed + if (message._resume) { + this.ready = true; + return; + } + // Shard is requesting a property fetch if (message._sFetchProp) { const resp = { _sFetchProp: message._sFetchProp, _sFetchPropShard: message._sFetchPropShard }; diff --git a/packages/discord.js/src/sharding/ShardClientUtil.js b/packages/discord.js/src/sharding/ShardClientUtil.js index edb799d016ec..c1bd4a800571 100644 --- a/packages/discord.js/src/sharding/ShardClientUtil.js +++ b/packages/discord.js/src/sharding/ShardClientUtil.js @@ -42,6 +42,9 @@ class ShardClientUtil { client.on(Events.ShardReconnecting, () => { process.send({ _reconnecting: true }); }); + client.on(Events.ShardResume, () => { + process.send({ _resume: true }); + }); break; case 'worker': this.parentPort = require('node:worker_threads').parentPort; @@ -55,6 +58,9 @@ class ShardClientUtil { client.on(Events.ShardReconnecting, () => { this.parentPort.postMessage({ _reconnecting: true }); }); + client.on(Events.ShardResume, () => { + this.parentPort.postMessage({ _resume: true }); + }); break; } }