mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 02:23:31 +01:00
refactor(ws): event layout (#10376)
* refactor(ws): event layout BREAKING CHANGE: All events now emit shard id as its own param * fix: worker event forwarding --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -148,12 +148,11 @@ export class WorkerBootstrapper {
|
||||
for (const shardId of this.data.shardIds) {
|
||||
const shard = new WebSocketShard(new WorkerContextFetchingStrategy(this.data), shardId);
|
||||
for (const event of options.forwardEvents ?? Object.values(WebSocketShardEvents)) {
|
||||
// @ts-expect-error: Event types incompatible
|
||||
shard.on(event, (data) => {
|
||||
shard.on(event, (...args) => {
|
||||
const payload: WorkerReceivePayload = {
|
||||
op: WorkerReceivePayloadOp.Event,
|
||||
event,
|
||||
data,
|
||||
data: args,
|
||||
shardId,
|
||||
};
|
||||
parentPort!.postMessage(payload);
|
||||
|
||||
Reference in New Issue
Block a user