mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
docs(StoreChannel): add deprecation warnings (#7080)
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user