fix: update cache before executing the event? (#313)

* fix: update cache before executing the event?

* fix: remove unnecessary cache update in event handler
This commit is contained in:
JustEvil 2024-12-26 09:13:55 -06:00 committed by GitHub
parent 31af4675a3
commit 8b0ba23b1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -189,15 +189,16 @@ export class EventHandler extends BaseHandler {
}
Event.fired = true;
const hook = await RawEvents[name]?.(client, packet as never);
await (Event.run as any)(hook, client, shardId);
} catch (e) {
await this.onFail(name, e);
} finally {
if (runCache)
await this.client.cache.onPacket({
t: name,
d: packet,
} as GatewayDispatchPayload);
await (Event.run as any)(hook, client, shardId);
} catch (e) {
await this.onFail(name, e);
}
}