mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
feat: api v9 and threads (#5570)
Co-authored-by: Noel <icrawltogo@gmail.com> Co-authored-by: Amish Shah <dev@shah.gg> Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com> Co-authored-by: SynthGhost <60333233+synthghost@users.noreply.github.com> Co-authored-by: SpaceEEC <24881032+SpaceEEC@users.noreply.github.com> Co-authored-by: Elliot <elliot@maisl.fr> Co-authored-by: Antonio Román <kyradiscord@gmail.com> Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
This commit is contained in:
@@ -4,7 +4,7 @@ const BaseManager = require('./BaseManager');
|
||||
const GuildChannel = require('../structures/GuildChannel');
|
||||
const PermissionOverwrites = require('../structures/PermissionOverwrites');
|
||||
const Collection = require('../util/Collection');
|
||||
const { ChannelTypes } = require('../util/Constants');
|
||||
const { ChannelTypes, ThreadChannelTypes } = require('../util/Constants');
|
||||
|
||||
/**
|
||||
* Manages API methods for GuildChannels and stores their cache.
|
||||
@@ -21,6 +21,19 @@ class GuildChannelManager extends BaseManager {
|
||||
this.guild = guild;
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of channels in this managers cache excluding thread channels
|
||||
* that do not count towards a guild's maximum channels restriction.
|
||||
* @type {number}
|
||||
* @readonly
|
||||
*/
|
||||
get channelCountWithoutThreads() {
|
||||
return this.cache.reduce((acc, channel) => {
|
||||
if (ThreadChannelTypes.includes(channel.type)) return acc;
|
||||
return ++acc;
|
||||
}, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* The cache of this Manager
|
||||
* @type {Collection<Snowflake, GuildChannel>}
|
||||
|
||||
Reference in New Issue
Block a user