Add invite.delete()

This commit is contained in:
Amish Shah
2016-08-28 20:51:21 +01:00
parent ba3d104619
commit 1dba048d2e
3 changed files with 17 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@@ -510,6 +510,14 @@ class RESTMethods {
.catch(reject);
});
}
deleteInvite(invite) {
return new Promise((resolve, reject) => {
this.rest.makeRequest('del', Constants.Endpoints.invite(invite.code), true)
.then(() => resolve(invite))
.catch(reject);
});
}
}
module.exports = RESTMethods;

View File

@@ -92,6 +92,14 @@ class Invite {
*/
this.channels = this.client.channels.get(data.channel.id) || new PartialGuildChannel(this.client, data.channel);
}
/**
* Deletes this invite
* @returns {Promise<Invite, Error>}
*/
delete() {
return this.client.rest.methods.deleteInvite(this);
}
}
module.exports = Invite;