From 7c540764f05cf0a7d312e468f828f427ec0f7541 Mon Sep 17 00:00:00 2001 From: Kevin Date: Sun, 1 Aug 2021 17:58:06 +0200 Subject: [PATCH] refactor(GuildChannel): use filter method for #members (#6253) Co-authored-by: ckohen --- src/structures/GuildChannel.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 0d711de25..002d372e5 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -1,6 +1,5 @@ 'use strict'; -const { Collection } = require('@discordjs/collection'); const Channel = require('./Channel'); const PermissionOverwrites = require('./PermissionOverwrites'); const { Error } = require('../errors'); @@ -258,13 +257,7 @@ class GuildChannel extends Channel { * @readonly */ get members() { - const members = new Collection(); - for (const member of this.guild.members.cache.values()) { - if (this.permissionsFor(member).has(Permissions.FLAGS.VIEW_CHANNEL, false)) { - members.set(member.id, member); - } - } - return members; + return this.guild.members.cache.filter(m => this.permissionsFor(m).has(Permissions.FLAGS.VIEW_CHANNEL, false)); } /**