diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index a79f11bae..324b6aeda 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -430,6 +430,21 @@ class GuildChannel extends Channel { .then(invite => new Invite(this.client, invite)); } + /** + * Fetches a collection of invites to this guild channel. + * Resolves with a collection mapping invites by their codes. + * @returns {Promise>} + */ + async fetchInvites() { + const inviteItems = await this.client.api.channels(this.id).invites.get(); + const invites = new Collection(); + for (const inviteItem of inviteItems) { + const invite = new Invite(this.client, inviteItem); + invites.set(invite.code, invite); + } + return invites; + } + /** * Clones this channel. * @param {Object} [options] The options