mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
fix: channels being removed from guild.channels
This commit is contained in:
@@ -54,8 +54,11 @@ class ChannelStore extends DataStore {
|
|||||||
|
|
||||||
add(data, guild, cache = true) {
|
add(data, guild, cache = true) {
|
||||||
const existing = this.get(data.id);
|
const existing = this.get(data.id);
|
||||||
if (existing && existing.partial && cache) existing._patch(data);
|
if (existing && existing._patch && cache) existing._patch(data);
|
||||||
if (existing) return existing;
|
if (existing) {
|
||||||
|
guild.channels.add(existing);
|
||||||
|
return existing;
|
||||||
|
}
|
||||||
|
|
||||||
const channel = Channel.create(this.client, data, guild);
|
const channel = Channel.create(this.client, data, guild);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const Channel = require('../structures/Channel');
|
|
||||||
const { ChannelTypes } = require('../util/Constants');
|
const { ChannelTypes } = require('../util/Constants');
|
||||||
const DataStore = require('./DataStore');
|
const DataStore = require('./DataStore');
|
||||||
const GuildChannel = require('../structures/GuildChannel');
|
const GuildChannel = require('../structures/GuildChannel');
|
||||||
@@ -16,11 +15,11 @@ class GuildChannelStore extends DataStore {
|
|||||||
this.guild = guild;
|
this.guild = guild;
|
||||||
}
|
}
|
||||||
|
|
||||||
add(data) {
|
add(channel) {
|
||||||
const existing = this.get(data.id);
|
const existing = this.get(channel.id);
|
||||||
if (existing) return existing;
|
if (existing) return existing;
|
||||||
|
this.set(channel.id, channel);
|
||||||
return Channel.create(this.client, data, this.guild);
|
return channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user