docs(StoreChannel): add deprecation warnings (#7080)

Co-authored-by: Antonio Román <kyradiscord@gmail.com>
This commit is contained in:
Rodry
2021-12-08 17:51:07 +00:00
committed by GitHub
parent 4515bb1ab2
commit fdba146f9b
3 changed files with 18 additions and 1 deletions

View File

@@ -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,

View File

@@ -4,6 +4,9 @@ const GuildChannel = require('./GuildChannel');
/**
* Represents a guild store channel on Discord.
* <warn>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.</warn>
* @extends {GuildChannel}
*/
class StoreChannel extends GuildChannel {

View File

@@ -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
* <warn>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.</warn>
* * `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