From f39b597e3120701287e86acdb247b4815f693c91 Mon Sep 17 00:00:00 2001 From: Francis Rivard Date: Mon, 23 Aug 2021 16:18:49 +0200 Subject: [PATCH] feat(Message): prevent fetching an interaction webhook. (#6468) --- src/errors/Messages.js | 1 + src/structures/Message.js | 1 + 2 files changed, 2 insertions(+) diff --git a/src/errors/Messages.js b/src/errors/Messages.js index d25c868dbe03..e631bb3ab4a8 100644 --- a/src/errors/Messages.js +++ b/src/errors/Messages.js @@ -103,6 +103,7 @@ const Messages = { WEBHOOK_MESSAGE: 'The message was not sent by a webhook.', WEBHOOK_TOKEN_UNAVAILABLE: 'This action requires a webhook token, but none is available.', WEBHOOK_URL_INVALID: 'The provided webhook URL is not valid.', + WEBHOOK_APPLICATION: 'This message webhook belongs to an application and cannot be fetched.', MESSAGE_REFERENCE_MISSING: 'The message does not reference another message', EMOJI_TYPE: 'Emoji must be a string or GuildEmoji/ReactionEmoji', diff --git a/src/structures/Message.js b/src/structures/Message.js index eb04aa91e79f..11b6e282f39a 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -788,6 +788,7 @@ class Message extends Base { */ fetchWebhook() { if (!this.webhookId) return Promise.reject(new Error('WEBHOOK_MESSAGE')); + if (this.webhookId === this.applicationId) return Promise.reject(new Error('WEBHOOK_APPLICATION')); return this.client.fetchWebhook(this.webhookId); }