From 6b85f900fa8e6cc01f7ee14ae730950cf1635dd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8A=88=EB=A6=AC=ED=8A=AC?= <9804cjh@naver.com> Date: Thu, 29 Jul 2021 19:55:37 +0900 Subject: [PATCH] fix(TextBasedChannel): Fix MessageCreate handling (#6217) --- src/structures/interfaces/TextBasedChannel.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/structures/interfaces/TextBasedChannel.js b/src/structures/interfaces/TextBasedChannel.js index 09fbe47b21b0..550240088395 100644 --- a/src/structures/interfaces/TextBasedChannel.js +++ b/src/structures/interfaces/TextBasedChannel.js @@ -167,9 +167,15 @@ class TextBasedChannel { } const { data, files } = await messagePayload.resolveFiles(); - return this.client.api.channels[this.id].messages - .post({ data, files }) - .then(d => this.client.actions.MessageCreate.handle(d).message); + const d = await this.client.api.channels[this.id].messages.post({ data, files }); + + const existing = this.messages.cache.get(d.id); + if (existing) { + const clone = existing._clone(); + clone._patch(d); + return clone; + } + return this.messages._add(d); } /**