Added Guild.fetchBans()

This commit is contained in:
Amish Shah
2016-08-27 22:48:43 +01:00
parent 22062f1f86
commit ef0f38930f
3 changed files with 25 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
const Constants = require('../../util/Constants');
const Collection = require('../../util/Collection');
const getStructure = name => require(`../../structures/${name}`);
const User = getStructure('User');
@@ -414,6 +415,21 @@ class RESTMethods {
});
}
getGuildBans(guild) {
return new Promise((resolve, reject) => {
this.rest.makeRequest('get', Constants.Endpoints.guildBans(guild.id), true)
.then(banItems => {
const bannedUsers = new Collection();
for (const banItem of banItems) {
const user = this.rest.client.dataManager.newUser(banItem.user);
bannedUsers.set(user.id, user);
}
resolve(bannedUsers);
})
.catch(reject);
});
}
updateGuildRole(role, _data) {
return new Promise((resolve, reject) => {
/*