fix(Message): delete method caused messageDelete event to fire twice (#3252)

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

* return existing data.*

* use Action.getUser()

* Fix messageDelete double emission
This commit is contained in:
Khoo Hao Yit
2019-08-18 01:33:03 +08:00
committed by SpaceEEC
parent ab27dd0218
commit 8ae7a30d0b

View File

@@ -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(() => {