From f0f22f8cabf6b999e98adcd7e19a9a282fc3b899 Mon Sep 17 00:00:00 2001 From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com> Date: Thu, 20 Apr 2023 16:58:32 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20webhook=20resolveData=20#?= =?UTF-8?q?626?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 💀 --- src/managers/GuildForumThreadManager.js | 4 ++-- src/structures/Webhook.js | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/managers/GuildForumThreadManager.js b/src/managers/GuildForumThreadManager.js index d799919..ec26179 100644 --- a/src/managers/GuildForumThreadManager.js +++ b/src/managers/GuildForumThreadManager.js @@ -63,9 +63,9 @@ class GuildForumThreadManager extends ThreadManager { let messagePayload; if (message instanceof MessagePayload) { - messagePayload = message.resolveData(); + messagePayload = await message.resolveData(); } else { - messagePayload = MessagePayload.create(this, message).resolveData(); + messagePayload = await MessagePayload.create(this, message).resolveData(); } let { data: body, files } = await messagePayload.resolveFiles(); diff --git a/src/structures/Webhook.js b/src/structures/Webhook.js index 49660a8..1b1b1aa 100644 --- a/src/structures/Webhook.js +++ b/src/structures/Webhook.js @@ -188,9 +188,9 @@ class Webhook { let messagePayload; if (options instanceof MessagePayload) { - messagePayload = options.resolveData(); + messagePayload = await options.resolveData(); } else { - messagePayload = MessagePayload.create(this, options).resolveData(); + messagePayload = await MessagePayload.create(this, options).resolveData(); } const { data, files } = await messagePayload.resolveFiles(); @@ -199,6 +199,7 @@ class Webhook { files, query: { thread_id: messagePayload.options.threadId, wait: true }, auth: false, + webhook: true, }); return this.client.channels?.cache.get(d.channel_id)?.messages._add(d, false) ?? d; } @@ -228,6 +229,7 @@ class Webhook { query: { wait: true }, auth: false, data: body, + webhook: true, }); return data.toString() === 'ok'; } @@ -256,6 +258,7 @@ class Webhook { data: { name, avatar, channel_id: channel }, reason, auth: !this.token || Boolean(channel), + webhook: true, }); this.name = data.name; @@ -304,6 +307,7 @@ class Webhook { thread_id: cacheOrOptions.threadId, }, auth: false, + webhook: true, }); return this.client.channels?.cache.get(data.channel_id)?.messages._add(data, cacheOrOptions.cache) ?? data; } @@ -335,6 +339,7 @@ class Webhook { thread_id: messagePayload.options.threadId, }, auth: false, + webhook: true, }); const messageManager = this.client.channels?.cache.get(d.channel_id)?.messages; @@ -354,7 +359,7 @@ class Webhook { * @returns {Promise} */ async delete(reason) { - await this.client.api.webhooks(this.id, this.token).delete({ reason, auth: !this.token }); + await this.client.api.webhooks(this.id, this.token).delete({ reason, auth: !this.token, webhook: true }); } /** @@ -374,6 +379,7 @@ class Webhook { thread_id: threadId, }, auth: false, + webhook: true, }); }