From b3865597af8ff90186e5f8b6d3fb63c128081eb7 Mon Sep 17 00:00:00 2001 From: pakkographic <41129374+pakkographic@users.noreply.github.com> Date: Tue, 13 Aug 2024 22:16:22 +0200 Subject: [PATCH] Remove duplicate IDs inside replyMessageIDs array Message --- lib/routes/Channels.ts | 2 ++ lib/structures/Message.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/lib/routes/Channels.ts b/lib/routes/Channels.ts index a24dd19..bfdc2fc 100644 --- a/lib/routes/Channels.ts +++ b/lib/routes/Channels.ts @@ -386,6 +386,7 @@ export class Channels { params?: MessageConstructorParams ): Promise> { if (typeof options !== "object") throw new Error("message options should be an object."); + options.replyMessageIDs = [...new Set(options.replyMessageIDs)]; // Remove duplicates. return this.#manager.authRequest({ method: "POST", path: endpoints.CHANNEL_MESSAGES(channelID), @@ -1025,6 +1026,7 @@ export class Channels { params?: MessageConstructorParams ): Promise> { if (typeof newMessage !== "object") throw new Error("newMessage should be an object."); + newMessage.replyMessageIDs = [...new Set(newMessage.replyMessageIDs)]; // Remove duplicates. return this.#manager.authRequest({ method: "PUT", path: endpoints.CHANNEL_MESSAGE(channelID, messageID), diff --git a/lib/structures/Message.ts b/lib/structures/Message.ts index f9aca24..d469d5a 100644 --- a/lib/structures/Message.ts +++ b/lib/structures/Message.ts @@ -297,6 +297,7 @@ export class Message extends Base { if (options.replyMessageIDs?.includes(this.originals.triggerID ?? " ")) { options.replyMessageIDs[options.replyMessageIDs.length - 1] = this.originals.responseID; } + const response = await this.client.rest.channels.createMessage( this.channelID,