Skip to content

Commit

Permalink
docs(StoreChannel): add deprecation warnings (#7080)
Browse files Browse the repository at this point in the history
Co-authored-by: Antonio Román <[email protected]>
  • Loading branch information
ImRodry and kyranet authored Dec 8, 2021
1 parent 4515bb1 commit fdba146
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/managers/GuildChannelManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/structures/StoreChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions src/util/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fdba146

Please sign in to comment.