mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
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:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user