diff --git a/src/managers/GuildChannelManager.js b/src/managers/GuildChannelManager.js index 89ed310e1..658d3a100 100644 --- a/src/managers/GuildChannelManager.js +++ b/src/managers/GuildChannelManager.js @@ -10,6 +10,7 @@ const ThreadChannel = require('../structures/ThreadChannel'); const { ChannelTypes, ThreadChannelTypes } = require('../util/Constants'); let cacheWarningEmitted = false; +let storeChannelDeprecationEmitted = false; /** * Manages API methods for GuildChannels and stores their cache. @@ -137,12 +138,22 @@ class GuildChannelManager extends CachedManager { ) { parent &&= this.client.channels.resolveId(parent); permissionOverwrites &&= permissionOverwrites.map(o => PermissionOverwrites.resolve(o, this.guild)); + const intType = typeof type === 'number' ? type : ChannelTypes[type] ?? ChannelTypes.GUILD_TEXT; + + if (intType === ChannelTypes.GUILD_STORE && !storeChannelDeprecationEmitted) { + storeChannelDeprecationEmitted = true; + process.emitWarning( + // eslint-disable-next-line max-len + 'Creating store channels is deprecated by Discord and will stop working in March 2022. Check the docs for more info.', + 'DeprecationWarning', + ); + } const data = await this.client.api.guilds(this.guild.id).channels.post({ data: { name, topic, - type: typeof type === 'number' ? type : ChannelTypes[type] ?? ChannelTypes.GUILD_TEXT, + type: intType, nsfw, bitrate, user_limit: userLimit, diff --git a/src/structures/StoreChannel.js b/src/structures/StoreChannel.js index bd4bd5602..e8bd745fd 100644 --- a/src/structures/StoreChannel.js +++ b/src/structures/StoreChannel.js @@ -4,6 +4,9 @@ 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 { diff --git a/src/util/Constants.js b/src/util/Constants.js index 5c9fab36c..caff36b48 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -465,6 +465,9 @@ exports.ActivityTypes = createEnum(['PLAYING', 'STREAMING', 'LISTENING', 'WATCHI * * `GROUP_DM` - a group DM channel * * `GUILD_CATEGORY` - a guild category channel * * `GUILD_NEWS` - a guild news channel + * 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. * * `GUILD_STORE` - a guild store channel * * `GUILD_NEWS_THREAD` - a guild news channel's public thread channel * * `GUILD_PUBLIC_THREAD` - a guild text channel's public thread channel