diff --git a/packages/core/src/client.ts b/packages/core/src/client.ts index 900ae495296a..1965db6cb123 100644 --- a/packages/core/src/client.ts +++ b/packages/core/src/client.ts @@ -89,87 +89,83 @@ export interface IntrinsicProps { shardId: number; } -export interface WithIntrinsicProps extends IntrinsicProps { +export interface ToEventProps extends IntrinsicProps { data: Data; } export interface MappedEvents { [GatewayDispatchEvents.ApplicationCommandPermissionsUpdate]: [ - WithIntrinsicProps, + ToEventProps, ]; [GatewayDispatchEvents.AutoModerationActionExecution]: [ - WithIntrinsicProps, - ]; - [GatewayDispatchEvents.AutoModerationRuleCreate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.AutoModerationRuleDelete]: [WithIntrinsicProps]; - [GatewayDispatchEvents.AutoModerationRuleUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.ChannelCreate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.ChannelDelete]: [WithIntrinsicProps]; - [GatewayDispatchEvents.ChannelPinsUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.ChannelUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.EntitlementCreate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.EntitlementDelete]: [WithIntrinsicProps]; - [GatewayDispatchEvents.EntitlementUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildAuditLogEntryCreate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildBanAdd]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildBanRemove]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildCreate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildDelete]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildEmojisUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildIntegrationsUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildMemberAdd]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildMemberRemove]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildMemberUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildMembersChunk]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildRoleCreate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildRoleDelete]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildRoleUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildScheduledEventCreate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildScheduledEventDelete]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildScheduledEventUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildScheduledEventUserAdd]: [ - WithIntrinsicProps, + ToEventProps, ]; + [GatewayDispatchEvents.AutoModerationRuleCreate]: [ToEventProps]; + [GatewayDispatchEvents.AutoModerationRuleDelete]: [ToEventProps]; + [GatewayDispatchEvents.AutoModerationRuleUpdate]: [ToEventProps]; + [GatewayDispatchEvents.ChannelCreate]: [ToEventProps]; + [GatewayDispatchEvents.ChannelDelete]: [ToEventProps]; + [GatewayDispatchEvents.ChannelPinsUpdate]: [ToEventProps]; + [GatewayDispatchEvents.ChannelUpdate]: [ToEventProps]; + [GatewayDispatchEvents.EntitlementCreate]: [ToEventProps]; + [GatewayDispatchEvents.EntitlementDelete]: [ToEventProps]; + [GatewayDispatchEvents.EntitlementUpdate]: [ToEventProps]; + [GatewayDispatchEvents.GuildAuditLogEntryCreate]: [ToEventProps]; + [GatewayDispatchEvents.GuildBanAdd]: [ToEventProps]; + [GatewayDispatchEvents.GuildBanRemove]: [ToEventProps]; + [GatewayDispatchEvents.GuildCreate]: [ToEventProps]; + [GatewayDispatchEvents.GuildDelete]: [ToEventProps]; + [GatewayDispatchEvents.GuildEmojisUpdate]: [ToEventProps]; + [GatewayDispatchEvents.GuildIntegrationsUpdate]: [ToEventProps]; + [GatewayDispatchEvents.GuildMemberAdd]: [ToEventProps]; + [GatewayDispatchEvents.GuildMemberRemove]: [ToEventProps]; + [GatewayDispatchEvents.GuildMemberUpdate]: [ToEventProps]; + [GatewayDispatchEvents.GuildMembersChunk]: [ToEventProps]; + [GatewayDispatchEvents.GuildRoleCreate]: [ToEventProps]; + [GatewayDispatchEvents.GuildRoleDelete]: [ToEventProps]; + [GatewayDispatchEvents.GuildRoleUpdate]: [ToEventProps]; + [GatewayDispatchEvents.GuildScheduledEventCreate]: [ToEventProps]; + [GatewayDispatchEvents.GuildScheduledEventDelete]: [ToEventProps]; + [GatewayDispatchEvents.GuildScheduledEventUpdate]: [ToEventProps]; + [GatewayDispatchEvents.GuildScheduledEventUserAdd]: [ToEventProps]; [GatewayDispatchEvents.GuildScheduledEventUserRemove]: [ - WithIntrinsicProps, - ]; - [GatewayDispatchEvents.GuildStickersUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.GuildUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.IntegrationCreate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.IntegrationDelete]: [WithIntrinsicProps]; - [GatewayDispatchEvents.IntegrationUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.InteractionCreate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.InviteCreate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.InviteDelete]: [WithIntrinsicProps]; - [GatewayDispatchEvents.MessageCreate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.MessageDelete]: [WithIntrinsicProps]; - [GatewayDispatchEvents.MessageDeleteBulk]: [WithIntrinsicProps]; - [GatewayDispatchEvents.MessagePollVoteAdd]: [WithIntrinsicProps]; - [GatewayDispatchEvents.MessagePollVoteRemove]: [WithIntrinsicProps]; - [GatewayDispatchEvents.MessageReactionAdd]: [WithIntrinsicProps]; - [GatewayDispatchEvents.MessageReactionRemove]: [WithIntrinsicProps]; - [GatewayDispatchEvents.MessageReactionRemoveAll]: [WithIntrinsicProps]; - [GatewayDispatchEvents.MessageReactionRemoveEmoji]: [ - WithIntrinsicProps, + ToEventProps, ]; - [GatewayDispatchEvents.MessageUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.PresenceUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.Ready]: [WithIntrinsicProps]; - [GatewayDispatchEvents.Resumed]: [WithIntrinsicProps]; - [GatewayDispatchEvents.StageInstanceCreate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.StageInstanceDelete]: [WithIntrinsicProps]; - [GatewayDispatchEvents.StageInstanceUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.ThreadCreate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.ThreadDelete]: [WithIntrinsicProps]; - [GatewayDispatchEvents.ThreadListSync]: [WithIntrinsicProps]; - [GatewayDispatchEvents.ThreadMemberUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.ThreadMembersUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.ThreadUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.TypingStart]: [WithIntrinsicProps]; - [GatewayDispatchEvents.UserUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.VoiceServerUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.VoiceStateUpdate]: [WithIntrinsicProps]; - [GatewayDispatchEvents.WebhooksUpdate]: [WithIntrinsicProps]; + [GatewayDispatchEvents.GuildStickersUpdate]: [ToEventProps]; + [GatewayDispatchEvents.GuildUpdate]: [ToEventProps]; + [GatewayDispatchEvents.IntegrationCreate]: [ToEventProps]; + [GatewayDispatchEvents.IntegrationDelete]: [ToEventProps]; + [GatewayDispatchEvents.IntegrationUpdate]: [ToEventProps]; + [GatewayDispatchEvents.InteractionCreate]: [ToEventProps]; + [GatewayDispatchEvents.InviteCreate]: [ToEventProps]; + [GatewayDispatchEvents.InviteDelete]: [ToEventProps]; + [GatewayDispatchEvents.MessageCreate]: [ToEventProps]; + [GatewayDispatchEvents.MessageDelete]: [ToEventProps]; + [GatewayDispatchEvents.MessageDeleteBulk]: [ToEventProps]; + [GatewayDispatchEvents.MessagePollVoteAdd]: [ToEventProps]; + [GatewayDispatchEvents.MessagePollVoteRemove]: [ToEventProps]; + [GatewayDispatchEvents.MessageReactionAdd]: [ToEventProps]; + [GatewayDispatchEvents.MessageReactionRemove]: [ToEventProps]; + [GatewayDispatchEvents.MessageReactionRemoveAll]: [ToEventProps]; + [GatewayDispatchEvents.MessageReactionRemoveEmoji]: [ToEventProps]; + [GatewayDispatchEvents.MessageUpdate]: [ToEventProps]; + [GatewayDispatchEvents.PresenceUpdate]: [ToEventProps]; + [GatewayDispatchEvents.Ready]: [ToEventProps]; + [GatewayDispatchEvents.Resumed]: [ToEventProps]; + [GatewayDispatchEvents.StageInstanceCreate]: [ToEventProps]; + [GatewayDispatchEvents.StageInstanceDelete]: [ToEventProps]; + [GatewayDispatchEvents.StageInstanceUpdate]: [ToEventProps]; + [GatewayDispatchEvents.ThreadCreate]: [ToEventProps]; + [GatewayDispatchEvents.ThreadDelete]: [ToEventProps]; + [GatewayDispatchEvents.ThreadListSync]: [ToEventProps]; + [GatewayDispatchEvents.ThreadMemberUpdate]: [ToEventProps]; + [GatewayDispatchEvents.ThreadMembersUpdate]: [ToEventProps]; + [GatewayDispatchEvents.ThreadUpdate]: [ToEventProps]; + [GatewayDispatchEvents.TypingStart]: [ToEventProps]; + [GatewayDispatchEvents.UserUpdate]: [ToEventProps]; + [GatewayDispatchEvents.VoiceServerUpdate]: [ToEventProps]; + [GatewayDispatchEvents.VoiceStateUpdate]: [ToEventProps]; + [GatewayDispatchEvents.WebhooksUpdate]: [ToEventProps]; } export interface ManagerShardEventsMap extends MappedEvents {} @@ -199,12 +195,9 @@ export class Client extends AsyncEventEmitter { this.gateway = gateway; this.api = new API(rest); - this.gateway.on(WebSocketShardEvents.Dispatch, ({ data: dispatch, shardId }) => { - this.emit( - dispatch.t, - // @ts-expect-error event props can't be resolved properly, but they are correct - this.wrapIntrinsicProps(dispatch.d, shardId), - ); + this.gateway.on(WebSocketShardEvents.Dispatch, (dispatch, shardId) => { + // @ts-expect-error event props can't be resolved properly, but they are correct + this.emit(dispatch.t, this.toEventProps(dispatch.d, shardId)); }); } @@ -342,7 +335,7 @@ export class Client extends AsyncEventEmitter { }); } - private wrapIntrinsicProps(obj: ObjectType, shardId: number): WithIntrinsicProps { + private toEventProps(obj: ObjectType, shardId: number): ToEventProps { return { api: this.api, shardId, diff --git a/packages/ws/__tests__/strategy/WorkerShardingStrategy.test.ts b/packages/ws/__tests__/strategy/WorkerShardingStrategy.test.ts index 3277dcb3d553..4a96408d300c 100644 --- a/packages/ws/__tests__/strategy/WorkerShardingStrategy.test.ts +++ b/packages/ws/__tests__/strategy/WorkerShardingStrategy.test.ts @@ -91,7 +91,7 @@ vi.mock('node:worker_threads', async () => { op: WorkerReceivePayloadOp.Event, shardId: message.shardId, event: WebSocketShardEvents.Dispatch, - data: memberChunkData, + data: [memberChunkData], }; this.emit('message', response); @@ -204,10 +204,13 @@ test('spawn, connect, send a message, session info, and destroy', async () => { }; await manager.send(0, payload); expect(mockSend).toHaveBeenCalledWith(0, payload); - expect(managerEmitSpy).toHaveBeenCalledWith(WebSocketShardEvents.Dispatch, { - ...memberChunkData, - shardId: 0, - }); + expect(managerEmitSpy).toHaveBeenCalledWith( + WebSocketShardEvents.Dispatch, + { + ...memberChunkData, + }, + 0, + ); expect(mockRetrieveSessionInfo).toHaveBeenCalledWith(0); expect(mockUpdateSessionInfo).toHaveBeenCalledWith(0, { ...sessionInfo, sequence: sessionInfo.sequence + 1 }); diff --git a/packages/ws/src/strategies/sharding/SimpleShardingStrategy.ts b/packages/ws/src/strategies/sharding/SimpleShardingStrategy.ts index f1b7e8f83937..5daeba5f534f 100644 --- a/packages/ws/src/strategies/sharding/SimpleShardingStrategy.ts +++ b/packages/ws/src/strategies/sharding/SimpleShardingStrategy.ts @@ -28,8 +28,8 @@ export class SimpleShardingStrategy implements IShardingStrategy { const strategy = new SimpleContextFetchingStrategy(this.manager, strategyOptions); const shard = new WebSocketShard(strategy, shardId); for (const event of Object.values(WebSocketShardEvents)) { - // @ts-expect-error: Intentional - shard.on(event, (payload) => this.manager.emit(event, { ...payload, shardId })); + // @ts-expect-error Event props can't be resolved properly, but they are correct + shard.on(event, (...args) => this.manager.emit(event, ...args, shardId)); } this.shards.set(shardId, shard); diff --git a/packages/ws/src/strategies/sharding/WorkerShardingStrategy.ts b/packages/ws/src/strategies/sharding/WorkerShardingStrategy.ts index 9960bc7a740a..a3ed5450ea9f 100644 --- a/packages/ws/src/strategies/sharding/WorkerShardingStrategy.ts +++ b/packages/ws/src/strategies/sharding/WorkerShardingStrategy.ts @@ -48,7 +48,7 @@ export enum WorkerReceivePayloadOp { export type WorkerReceivePayload = // Can't seem to get a type-safe union based off of the event, so I'm sadly leaving data as any for now - | { data: any; event: WebSocketShardEvents; op: WorkerReceivePayloadOp.Event; shardId: number } + | { data: any[]; event: WebSocketShardEvents; op: WorkerReceivePayloadOp.Event; shardId: number } | { nonce: number; op: WorkerReceivePayloadOp.CancelIdentify } | { nonce: number; op: WorkerReceivePayloadOp.FetchStatusResponse; status: WebSocketShardStatus } | { nonce: number; op: WorkerReceivePayloadOp.RetrieveSessionInfo; shardId: number } @@ -293,7 +293,8 @@ export class WorkerShardingStrategy implements IShardingStrategy { } case WorkerReceivePayloadOp.Event: { - this.manager.emit(payload.event, { ...payload.data, shardId: payload.shardId }); + // @ts-expect-error Event props can't be resolved properly, but they are correct + this.manager.emit(payload.event, ...payload.data, payload.shardId); break; } diff --git a/packages/ws/src/utils/WorkerBootstrapper.ts b/packages/ws/src/utils/WorkerBootstrapper.ts index dd101293e969..86913f4f690b 100644 --- a/packages/ws/src/utils/WorkerBootstrapper.ts +++ b/packages/ws/src/utils/WorkerBootstrapper.ts @@ -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); diff --git a/packages/ws/src/ws/WebSocketManager.ts b/packages/ws/src/ws/WebSocketManager.ts index 2bc8a601c006..b52cd1a20443 100644 --- a/packages/ws/src/ws/WebSocketManager.ts +++ b/packages/ws/src/ws/WebSocketManager.ts @@ -197,15 +197,15 @@ export interface CreateWebSocketManagerOptions RequiredWebSocketManagerOptions {} export interface ManagerShardEventsMap { - [WebSocketShardEvents.Closed]: [{ code: number; shardId: number }]; - [WebSocketShardEvents.Debug]: [payload: { message: string; shardId: number }]; - [WebSocketShardEvents.Dispatch]: [payload: { data: GatewayDispatchPayload; shardId: number }]; - [WebSocketShardEvents.Error]: [payload: { error: Error; shardId: number }]; - [WebSocketShardEvents.Hello]: [{ shardId: number }]; - [WebSocketShardEvents.Ready]: [payload: { data: GatewayReadyDispatchData; shardId: number }]; - [WebSocketShardEvents.Resumed]: [{ shardId: number }]; + [WebSocketShardEvents.Closed]: [code: number, shardId: number]; + [WebSocketShardEvents.Debug]: [message: string, shardId: number]; + [WebSocketShardEvents.Dispatch]: [payload: GatewayDispatchPayload, shardId: number]; + [WebSocketShardEvents.Error]: [error: Error, shardId: number]; + [WebSocketShardEvents.Hello]: [shardId: number]; + [WebSocketShardEvents.Ready]: [data: GatewayReadyDispatchData, shardId: number]; + [WebSocketShardEvents.Resumed]: [shardId: number]; [WebSocketShardEvents.HeartbeatComplete]: [ - payload: { ackAt: number; heartbeatAt: number; latency: number; shardId: number }, + stats: { ackAt: number; heartbeatAt: number; latency: number; shardId: number }, ]; } diff --git a/packages/ws/src/ws/WebSocketShard.ts b/packages/ws/src/ws/WebSocketShard.ts index f108210cce62..f30142f83f9c 100644 --- a/packages/ws/src/ws/WebSocketShard.ts +++ b/packages/ws/src/ws/WebSocketShard.ts @@ -60,14 +60,14 @@ export enum WebSocketShardDestroyRecovery { } export interface WebSocketShardEventsMap { - [WebSocketShardEvents.Closed]: [{ code: number }]; - [WebSocketShardEvents.Debug]: [payload: { message: string }]; - [WebSocketShardEvents.Dispatch]: [payload: { data: GatewayDispatchPayload }]; - [WebSocketShardEvents.Error]: [payload: { error: Error }]; + [WebSocketShardEvents.Closed]: [code: number]; + [WebSocketShardEvents.Debug]: [message: string]; + [WebSocketShardEvents.Dispatch]: [payload: GatewayDispatchPayload]; + [WebSocketShardEvents.Error]: [error: Error]; [WebSocketShardEvents.Hello]: []; - [WebSocketShardEvents.Ready]: [payload: { data: GatewayReadyDispatchData }]; + [WebSocketShardEvents.Ready]: [payload: GatewayReadyDispatchData]; [WebSocketShardEvents.Resumed]: []; - [WebSocketShardEvents.HeartbeatComplete]: [payload: { ackAt: number; heartbeatAt: number; latency: number }]; + [WebSocketShardEvents.HeartbeatComplete]: [stats: { ackAt: number; heartbeatAt: number; latency: number }]; } export interface WebSocketShardDestroyOptions { @@ -203,7 +203,7 @@ export class WebSocketShard extends AsyncEventEmitter { }); inflate.on('error', (error) => { - this.emit(WebSocketShardEvents.Error, { error }); + this.emit(WebSocketShardEvents.Error, error); }); this.nativeInflate = inflate; @@ -352,7 +352,7 @@ export class WebSocketShard extends AsyncEventEmitter { this.connection.close(options.code, options.reason); await promise; - this.emit(WebSocketShardEvents.Closed, { code: options.code }); + this.emit(WebSocketShardEvents.Closed, options.code); } // Lastly, remove the error event. @@ -639,11 +639,10 @@ export class WebSocketShard extends AsyncEventEmitter { this.zLibSyncInflate.push(Buffer.from(decompressable), flush ? zLibSync.Z_SYNC_FLUSH : zLibSync.Z_NO_FLUSH); if (this.zLibSyncInflate.err) { - this.emit(WebSocketShardEvents.Error, { - error: new Error( - `${this.zLibSyncInflate.err}${this.zLibSyncInflate.msg ? `: ${this.zLibSyncInflate.msg}` : ''}`, - ), - }); + this.emit( + WebSocketShardEvents.Error, + new Error(`${this.zLibSyncInflate.err}${this.zLibSyncInflate.msg ? `: ${this.zLibSyncInflate.msg}` : ''}`), + ); } if (!flush) { @@ -692,7 +691,7 @@ export class WebSocketShard extends AsyncEventEmitter { await this.strategy.updateSessionInfo(this.id, session); - this.emit(WebSocketShardEvents.Ready, { data: payload.d }); + this.emit(WebSocketShardEvents.Ready, payload.d); break; } @@ -719,7 +718,7 @@ export class WebSocketShard extends AsyncEventEmitter { ]); } - this.emit(WebSocketShardEvents.Dispatch, { data: payload }); + this.emit(WebSocketShardEvents.Dispatch, payload); break; } @@ -798,11 +797,11 @@ export class WebSocketShard extends AsyncEventEmitter { return; } - this.emit(WebSocketShardEvents.Error, { error }); + this.emit(WebSocketShardEvents.Error, error); } private async onClose(code: number) { - this.emit(WebSocketShardEvents.Closed, { code }); + this.emit(WebSocketShardEvents.Closed, code); switch (code) { case CloseCodes.Normal: { @@ -838,9 +837,11 @@ export class WebSocketShard extends AsyncEventEmitter { } case GatewayCloseCodes.AuthenticationFailed: { - this.emit(WebSocketShardEvents.Error, { - error: new Error('Authentication failed'), - }); + this.emit( + WebSocketShardEvents.Error, + + new Error('Authentication failed'), + ); return this.destroy({ code }); } @@ -865,37 +866,43 @@ export class WebSocketShard extends AsyncEventEmitter { } case GatewayCloseCodes.InvalidShard: { - this.emit(WebSocketShardEvents.Error, { - error: new Error('Invalid shard'), - }); + this.emit(WebSocketShardEvents.Error, new Error('Invalid shard')); return this.destroy({ code }); } case GatewayCloseCodes.ShardingRequired: { - this.emit(WebSocketShardEvents.Error, { - error: new Error('Sharding is required'), - }); + this.emit( + WebSocketShardEvents.Error, + + new Error('Sharding is required'), + ); return this.destroy({ code }); } case GatewayCloseCodes.InvalidAPIVersion: { - this.emit(WebSocketShardEvents.Error, { - error: new Error('Used an invalid API version'), - }); + this.emit( + WebSocketShardEvents.Error, + + new Error('Used an invalid API version'), + ); return this.destroy({ code }); } case GatewayCloseCodes.InvalidIntents: { - this.emit(WebSocketShardEvents.Error, { - error: new Error('Used invalid intents'), - }); + this.emit( + WebSocketShardEvents.Error, + + new Error('Used invalid intents'), + ); return this.destroy({ code }); } case GatewayCloseCodes.DisallowedIntents: { - this.emit(WebSocketShardEvents.Error, { - error: new Error('Used disallowed intents'), - }); + this.emit( + WebSocketShardEvents.Error, + + new Error('Used disallowed intents'), + ); return this.destroy({ code }); } @@ -916,6 +923,6 @@ export class WebSocketShard extends AsyncEventEmitter { } private debug(messages: [string, ...string[]]) { - this.emit(WebSocketShardEvents.Debug, { message: messages.join('\n\t') }); + this.emit(WebSocketShardEvents.Debug, messages.join('\n\t')); } }