diff --git a/src/rest/DiscordAPIError.js b/src/rest/DiscordAPIError.js index fa54546b1604..af060da30c4b 100644 --- a/src/rest/DiscordAPIError.js +++ b/src/rest/DiscordAPIError.js @@ -40,7 +40,7 @@ class DiscordAPIError extends Error { * @type {HTTPErrorData} */ this.requestData = { - jsonData: request.options.data, + json: request.options.data, files: request.options.files ?? [], }; } diff --git a/src/rest/HTTPError.js b/src/rest/HTTPError.js index 18bbbd235c58..8613cd947529 100644 --- a/src/rest/HTTPError.js +++ b/src/rest/HTTPError.js @@ -35,7 +35,7 @@ class HTTPError extends Error { /** * The HTTP data that was sent to Discord * @typedef {Object} HTTPErrorData - * @property {*} jsonData The JSON data that was sent + * @property {*} json The JSON data that was sent * @property {HTTPAttachmentData[]} files The files that were sent with this request, if any */ @@ -51,7 +51,7 @@ class HTTPError extends Error { * @type {HTTPErrorData} */ this.requestData = { - jsonData: request.options.data, + json: request.options.data, files: request.options.files ?? [], }; } diff --git a/src/structures/APIMessage.js b/src/structures/APIMessage.js index c3bcfab32d8c..41989ecf1788 100644 --- a/src/structures/APIMessage.js +++ b/src/structures/APIMessage.js @@ -125,6 +125,7 @@ class APIMessage { */ resolveData() { if (this.data) return this; + const isWebhook = this.isWebhook; const content = this.makeContent(); const tts = Boolean(this.options.tts); @@ -139,7 +140,7 @@ class APIMessage { } const embedLikes = []; - if (this.isInteraction || this.isWebhook) { + if (this.isInteraction || isWebhook) { if (this.options.embeds) { embedLikes.push(...this.options.embeds); } @@ -150,7 +151,7 @@ class APIMessage { let username; let avatarURL; - if (this.isWebhook) { + if (isWebhook) { username = this.options.username || this.target.name; if (this.options.avatarURL) avatarURL = this.options.avatarURL; } @@ -192,7 +193,7 @@ class APIMessage { tts, nonce, embed: this.options.embed === null ? null : embeds[0], - embeds, + embeds: isWebhook ? embeds : undefined, username, avatar_url: avatarURL, allowed_mentions: