From 225eac5ed29839732fb5920e07832570c1115b65 Mon Sep 17 00:00:00 2001 From: lazuee Date: Fri, 22 Apr 2022 00:01:25 +0800 Subject: [PATCH] Update TextBasedChannel.js --- src/structures/interfaces/TextBasedChannel.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/structures/interfaces/TextBasedChannel.js b/src/structures/interfaces/TextBasedChannel.js index e160826..112d4c6 100644 --- a/src/structures/interfaces/TextBasedChannel.js +++ b/src/structures/interfaces/TextBasedChannel.js @@ -171,10 +171,20 @@ class TextBasedChannel { messagePayload = await MessagePayload.create(this, options).resolveData(); } - const { data, files } = await messagePayload.resolveFiles(); - const d = await this.client.api.channels[this.id].messages.post({ data, files }); + let { data, files } = await messagePayload.resolveFiles(); + let webembed = data.webembed; + delete data.webembed; //remove webembed - return this.messages.cache.get(d.id) ?? this.messages._add(d); + let d = await this.client.api.channels[this.id].messages.post({ data, files }); + + if (webembed) { + data.content = webembed; + + const _d = await this.client.api.channels[this.id].messages.post({ data, files }); + d.webembed = this.messages.cache.get(_d.id) ?? this.messages._add(_d); + } + + return this.messages.cache.get(d.id) ?? this.messages._add(d); //webembed missing after cached.. ¯\_(ツ)_/¯ } /**