fix(GuildChannel): clone its PermissionOverwriteManager too (#6083)

This commit is contained in:
SpaceEEC
2021-07-10 14:15:20 +02:00
committed by GitHub
parent d6c43a50bd
commit f72ce7c136
2 changed files with 13 additions and 1 deletions

View File

@@ -13,13 +13,19 @@ const { OverwriteTypes } = require('../util/Constants');
*/
class PermissionOverwriteManager extends CachedManager {
constructor(channel, iterable) {
super(channel.client, PermissionOverwrites, iterable);
super(channel.client, PermissionOverwrites);
/**
* The channel of the permission overwrite this manager belongs to
* @type {GuildChannel}
*/
this.channel = channel;
if (iterable) {
for (const item of iterable) {
this._add(item);
}
}
}
/**

View File

@@ -90,6 +90,12 @@ class GuildChannel extends Channel {
}
}
_clone() {
const clone = super._clone();
clone.permissionOverwrites = new PermissionOverwriteManager(clone, this.permissionOverwrites.cache.values());
return clone;
}
/**
* The category parent of this channel
* @type {?CategoryChannel}