mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
Added guild.fetchInvites()
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -518,6 +518,21 @@ class RESTMethods {
|
||||
.catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
getGuildInvites(guild) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.rest.makeRequest('get', Constants.Endpoints.guildInvites(guild.id), true)
|
||||
.then(inviteItems => {
|
||||
const invites = new Collection();
|
||||
for (const inviteItem of inviteItems) {
|
||||
const invite = new Invite(this.rest.client, inviteItem);
|
||||
invites.set(invite.code, invite);
|
||||
}
|
||||
resolve(invites);
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = RESTMethods;
|
||||
|
||||
@@ -552,6 +552,14 @@ class Guild {
|
||||
return this.client.rest.methods.getGuildBans(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a Collection of invites to this Guild. Resolves with a Collection mapping invites by their codes.
|
||||
* @returns {Promise<Collection<String, Invite>, Error>}
|
||||
*/
|
||||
fetchInvites() {
|
||||
return this.client.rest.methods.getGuildInvites(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL to this guild's icon (if it has one, otherwise it returns null)
|
||||
* @type {?String}
|
||||
|
||||
Reference in New Issue
Block a user