feat(MessageStore): add remove() (#2468)

* MessageStore#remove()

* typings
This commit is contained in:
bdistin
2019-04-29 11:53:32 -05:00
committed by Amish Shah
parent d7a9b74523
commit 2666a9d6db
3 changed files with 16 additions and 7 deletions

View File

@@ -454,13 +454,11 @@ class Message extends Base {
*/
delete({ timeout = 0, reason } = {}) {
if (timeout <= 0) {
return this.client.api.channels(this.channel.id).messages(this.id)
.delete({ 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.client.actions.MessageDelete.handle({
id: this.id,
channel_id: this.channel.id,
}).message);
} else {
return new Promise(resolve => {
this.client.setTimeout(() => {