Skip to content

Commit

Permalink
fix(Message): delete method caused messageDelete event to fire twice (#…
Browse files Browse the repository at this point in the history
…3252)

* ref: add getPayload and use for other get* methods

* return existing data.*

* use Action.getUser()

* Fix messageDelete double emission
  • Loading branch information
KhooHaoYit authored and SpaceEEC committed Aug 17, 2019
1 parent ab27dd0 commit 8ae7a30
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/structures/Message.js
Expand Up @@ -454,11 +454,7 @@ class Message extends Base {
*/
delete({ timeout = 0, reason } = {}) {
if (timeout <= 0) {
return this.channel.messages.remove(this.id, reason).then(() =>
this.client.actions.MessageDelete.handle({
id: this.id,
channel_id: this.channel.id,
}).message);
return this.channel.messages.remove(this.id, reason).then(() => this);
} else {
return new Promise(resolve => {
this.client.setTimeout(() => {
Expand Down

0 comments on commit 8ae7a30

Please sign in to comment.