Skip to content

Commit

Permalink
fix(TextBasedChannel): Fix MessageCreate handling (#6217)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjh980402 committed Jul 29, 2021
1 parent 105a194 commit 6b85f90
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/structures/interfaces/TextBasedChannel.js
Expand Up @@ -167,9 +167,15 @@ class TextBasedChannel {
}

const { data, files } = await messagePayload.resolveFiles();
return this.client.api.channels[this.id].messages
.post({ data, files })
.then(d => this.client.actions.MessageCreate.handle(d).message);
const d = await this.client.api.channels[this.id].messages.post({ data, files });

const existing = this.messages.cache.get(d.id);
if (existing) {
const clone = existing._clone();
clone._patch(d);
return clone;
}
return this.messages._add(d);
}

/**
Expand Down

0 comments on commit 6b85f90

Please sign in to comment.