mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
refactor(GuildChannel): use filter method for #members (#6253)
Co-authored-by: ckohen <chaikohen@gmail.com>
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user