fix: cache

This commit is contained in:
MARCROCK22 2024-08-03 03:56:14 +00:00
parent 4061f00625
commit 449be8ea38
2 changed files with 6 additions and 2 deletions

View File

@ -161,7 +161,9 @@ export class Client<Ready extends boolean = boolean> extends BaseClient {
if (this.__handleGuilds?.has(packet.d.id)) {
this.__handleGuilds?.delete(packet.d.id);
if (!this.__handleGuilds?.size && [...this.gateway.values()].every(shard => shard.data.session_id)) {
await this.events?.runEvent('BOT_READY', this, this.me, -1);
delete this.__handleGuilds;
await this.cache.onPacket(packet);
return this.events?.runEvent('BOT_READY', this, this.me, -1);
}
if (!this.__handleGuilds?.size) delete this.__handleGuilds;
return this.cache.onPacket(packet);

View File

@ -381,11 +381,13 @@ export class WorkerClient<Ready extends boolean = boolean> extends BaseClient {
if (this.__handleGuilds?.has(packet.d.id)) {
this.__handleGuilds?.delete(packet.d.id);
if (!this.__handleGuilds?.size && [...this.shards.values()].every(shard => shard.data.session_id)) {
delete this.__handleGuilds;
await this.cache.onPacket(packet);
this.postMessage({
type: 'WORKER_READY',
workerId: this.workerId,
} as WorkerReady);
await this.events?.runEvent('WORKER_READY', this, this.me, -1);
return this.events?.runEvent('WORKER_READY', this, this.me, -1);
}
if (!this.__handleGuilds?.size) delete this.__handleGuilds;
return this.cache.onPacket(packet);