mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
fix(ThreadChannel): better property handling (#6172)
This commit is contained in:
@@ -19,10 +19,10 @@ class ChannelManager extends CachedManager {
|
||||
* @name ChannelManager#cache
|
||||
*/
|
||||
|
||||
_add(data, guild, cache = true, allowUnknownGuild = false) {
|
||||
_add(data, guild, { cache = true, allowUnknownGuild = false, fromInteraction = false } = {}) {
|
||||
const existing = this.cache.get(data.id);
|
||||
if (existing) {
|
||||
if (cache) existing._patch(data);
|
||||
if (cache) existing._patch(data, fromInteraction);
|
||||
guild?.channels?._add(existing);
|
||||
if (ThreadChannelTypes.includes(existing.type)) {
|
||||
existing.parent?.threads?._add(existing);
|
||||
@@ -30,7 +30,7 @@ class ChannelManager extends CachedManager {
|
||||
return existing;
|
||||
}
|
||||
|
||||
const channel = Channel.create(this.client, data, guild, allowUnknownGuild);
|
||||
const channel = Channel.create(this.client, data, guild, { allowUnknownGuild, fromInteraction });
|
||||
|
||||
if (!channel) {
|
||||
this.client.emit(Events.DEBUG, `Failed to find guild, or unknown type for channel ${data.id} ${data.type}`);
|
||||
@@ -99,7 +99,7 @@ class ChannelManager extends CachedManager {
|
||||
}
|
||||
|
||||
const data = await this.client.api.channels(id).get();
|
||||
return this._add(data, null, cache, allowUnknownGuild);
|
||||
return this._add(data, null, { cache, allowUnknownGuild });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user