mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 18:43: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:
@@ -2,7 +2,7 @@
|
||||
|
||||
const BaseManager = require('./BaseManager');
|
||||
const Channel = require('../structures/Channel');
|
||||
const { Events } = require('../util/Constants');
|
||||
const { Events, ThreadChannelTypes } = require('../util/Constants');
|
||||
|
||||
/**
|
||||
* A manager of channels belonging to a client
|
||||
@@ -24,6 +24,9 @@ class ChannelManager extends BaseManager {
|
||||
if (existing) {
|
||||
if (existing._patch && cache) existing._patch(data);
|
||||
if (guild) guild.channels?.add(existing);
|
||||
if (ThreadChannelTypes.includes(existing.type) && typeof existing.parent?.threads !== 'undefined') {
|
||||
existing.parent.threads.add(existing);
|
||||
}
|
||||
return existing;
|
||||
}
|
||||
|
||||
@@ -42,6 +45,7 @@ class ChannelManager extends BaseManager {
|
||||
remove(id) {
|
||||
const channel = this.cache.get(id);
|
||||
channel?.guild?.channels.cache.delete(id);
|
||||
channel?.parent?.threads?.cache.delete(id);
|
||||
this.cache.delete(id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user