refactor(Channels): fix incorrectly shared properties (#6262)

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
monbrey
2021-08-05 06:55:31 +10:00
committed by GitHub
parent ae6200e58e
commit 5be471b47d
8 changed files with 341 additions and 275 deletions

View File

@@ -80,6 +80,30 @@ class BaseGuildVoiceChannel extends GuildChannel {
setRTCRegion(region) {
return this.edit({ rtcRegion: region });
}
/**
* Creates an invite to this guild channel.
* @param {CreateInviteOptions} [options={}] The options for creating the invite
* @returns {Promise<Invite>}
* @example
* // Create an invite to a channel
* channel.createInvite()
* .then(invite => console.log(`Created an invite with a code of ${invite.code}`))
* .catch(console.error);
*/
createInvite(options) {
return this.guild.invites.create(this.id, options);
}
/**
* Fetches a collection of invites to this guild channel.
* Resolves with a collection mapping invites by their codes.
* @param {boolean} [cache=true] Whether or not to cache the fetched invites
* @returns {Promise<Collection<string, Invite>>}
*/
fetchInvites(cache = true) {
return this.guild.invites.fetch({ channelId: this.id, cache });
}
}
module.exports = BaseGuildVoiceChannel;