feat(Guild): add fetchBan and withReasons to fetchBans (#3170)

* add Guild#fetchBan() & backport BanInfo

* and the typings

* requested changes

* typings overloads

Co-Authored-By: izexi <43889168+izexi@users.noreply.github.com>

* nullable reason typings

Co-Authored-By: izexi <43889168+izexi@users.noreply.github.com>
This commit is contained in:
izexi
2019-04-01 08:07:52 +01:00
committed by SpaceEEC
parent 745e18b823
commit 5cd6d8d380
3 changed files with 42 additions and 3 deletions

View File

@@ -631,6 +631,14 @@ class RESTMethods {
});
}
getGuildBan(guild, user) {
const id = this.client.resolver.resolveUserID(user);
return this.rest.makeRequest('get', `${Endpoints.Guild(guild).bans}/${id}`, true).then(ban => ({
reason: ban.reason,
user: this.client.dataManager.newUser(ban.user),
}));
}
getGuildBans(guild) {
return this.rest.makeRequest('get', Endpoints.Guild(guild).bans, true).then(bans =>
bans.reduce((collection, ban) => {