diff --git a/lib/gateway/events/MessageHandler.ts b/lib/gateway/events/MessageHandler.ts index 3731794..b04020f 100644 --- a/lib/gateway/events/MessageHandler.ts +++ b/lib/gateway/events/MessageHandler.ts @@ -50,6 +50,8 @@ export class MessageHandler extends GatewayEventHandler { await this.addGuildChannel(data.serverId, data.message.channelId); else void this.addGuildChannel(data.serverId, data.message.channelId); + const treatmentStartTimestamp = performance.now(); + if ( this.client.application.enabled && !data.message.createdByWebhookId @@ -153,6 +155,16 @@ export class MessageHandler extends GatewayEventHandler { return void interaction.createMessage({ content, isPrivate: true }); } + + const treatmentEndTimestamp = performance.now(); + const treatmentDuration = treatmentEndTimestamp - treatmentStartTimestamp; + void this.client.util.requestDataCollection({ + event: "message_create_treatment", + data: { + duration: treatmentDuration + } + }); + return void this.client.emit( "interactionCreate", interaction diff --git a/lib/util/Util.ts b/lib/util/Util.ts index 638cff4..e944f41 100644 --- a/lib/util/Util.ts +++ b/lib/util/Util.ts @@ -231,9 +231,7 @@ export class Util { } async requestDataCollection( collect: { - data?: { - message: string; - }; + data?: object; event: string; } ): Promise {