Skip to content

Commit

Permalink
fix(GuildChannel): use map method on cache not its manager (#6032)
Browse files Browse the repository at this point in the history
  • Loading branch information
iShibi committed Jul 4, 2021
1 parent 610b0b4 commit d58f0d2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/structures/GuildChannel.js
Expand Up @@ -230,7 +230,7 @@ class GuildChannel extends Channel {
*/
lockPermissions() {
if (!this.parent) return Promise.reject(new Error('GUILD_CHANNEL_ORPHAN'));
const permissionOverwrites = this.parent.permissionOverwrites.map(overwrite => overwrite.toJSON());
const permissionOverwrites = this.parent.permissionOverwrites.cache.map(overwrite => overwrite.toJSON());
return this.edit({ permissionOverwrites });
}

Expand Down Expand Up @@ -310,10 +310,14 @@ class GuildChannel extends Channel {
if (data.parentID) {
const newParent = this.guild.channels.resolve(data.parentID);
if (newParent?.type === 'category') {
permission_overwrites = newParent.permissionOverwrites.map(o => PermissionOverwrites.resolve(o, this.guild));
permission_overwrites = newParent.permissionOverwrites.cache.map(o =>
PermissionOverwrites.resolve(o, this.guild),
);
}
} else if (this.parent) {
permission_overwrites = this.parent.permissionOverwrites.map(o => PermissionOverwrites.resolve(o, this.guild));
permission_overwrites = this.parent.permissionOverwrites.cache.map(o =>
PermissionOverwrites.resolve(o, this.guild),
);
}
}

Expand Down

0 comments on commit d58f0d2

Please sign in to comment.