Skip to content

Commit

Permalink
fix(APIMessage): don't send embeds for non-webhook requests
Browse files Browse the repository at this point in the history
  • Loading branch information
vladfrangu committed May 29, 2021
1 parent 6339ac1 commit 6c66226
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/structures/APIMessage.js
Expand Up @@ -125,6 +125,7 @@ class APIMessage {
*/
resolveData() {
if (this.data) return this;
const thisIsWebhook = this.isWebhook;

const content = this.makeContent();
const tts = Boolean(this.options.tts);
Expand All @@ -139,7 +140,7 @@ class APIMessage {
}

const embedLikes = [];
if (this.isInteraction || this.isWebhook) {
if (this.isInteraction || thisIsWebhook) {
if (this.options.embeds) {
embedLikes.push(...this.options.embeds);
}
Expand All @@ -150,7 +151,7 @@ class APIMessage {

let username;
let avatarURL;
if (this.isWebhook) {
if (thisIsWebhook) {
username = this.options.username || this.target.name;
if (this.options.avatarURL) avatarURL = this.options.avatarURL;
}
Expand Down Expand Up @@ -192,7 +193,7 @@ class APIMessage {
tts,
nonce,
embed: this.options.embed === null ? null : embeds[0],
embeds,
embeds: thisIsWebhook ? embeds : undefined,
username,
avatar_url: avatarURL,
allowed_mentions:
Expand Down

0 comments on commit 6c66226

Please sign in to comment.