'use strict'; const GuildChannel = require('./GuildChannel'); /** * Represents a guild store channel on Discord. * Store channels are deprecated and will be removed from Discord in March 2022. See * [Self-serve Game Selling Deprecation](https://support-dev.discord.com/hc/en-us/articles/4414590563479) * for more information. * @extends {GuildChannel} */ class StoreChannel extends GuildChannel { constructor(guild, data, client) { super(guild, data, client); /** * If the guild considers this channel NSFW * @type {boolean} */ this.nsfw = Boolean(data.nsfw); } _patch(data) { super._patch(data); if ('nsfw' in data) { this.nsfw = Boolean(data.nsfw); } } /** * Creates an invite to this guild channel. * @param {CreateInviteOptions} [options={}] The options for creating the invite * @returns {Promise} * @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>} */ fetchInvites(cache = true) { return this.guild.invites.fetch({ channelId: this.id, cache }); } } module.exports = StoreChannel;