mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
Added Guild.fetchBans()
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,4 +1,5 @@
|
|||||||
const Constants = require('../../util/Constants');
|
const Constants = require('../../util/Constants');
|
||||||
|
const Collection = require('../../util/Collection');
|
||||||
|
|
||||||
const getStructure = name => require(`../../structures/${name}`);
|
const getStructure = name => require(`../../structures/${name}`);
|
||||||
const User = getStructure('User');
|
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) {
|
updateGuildRole(role, _data) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -552,6 +552,14 @@ class Guild {
|
|||||||
return this.client.rest.methods.unbanGuildMember(this, member);
|
return this.client.rest.methods.unbanGuildMember(this, member);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch a Collection of banned users in this Guild.
|
||||||
|
* @returns {Promise<String, User>}
|
||||||
|
*/
|
||||||
|
fetchBans() {
|
||||||
|
return this.client.rest.methods.getGuildBans(this);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the URL to this guild's icon (if it has one, otherwise it returns null)
|
* Gets the URL to this guild's icon (if it has one, otherwise it returns null)
|
||||||
* @type {?String}
|
* @type {?String}
|
||||||
|
|||||||
Reference in New Issue
Block a user