Add TextChannel.members

This commit is contained in:
Amish Shah
2016-09-10 17:05:45 +01:00
parent 8c0685fa9a
commit c6aa16277a
2 changed files with 15 additions and 10 deletions

View File

@@ -27,6 +27,21 @@ class TextChannel extends GuildChannel {
this._typing = new Map();
}
/**
* A collection of members that can see this channel, mapped by their ID.
* @returns {Collection<string, GuildMember>}
* @readonly
*/
get members() {
const members = new Collection();
for (const member of this.guild.members.values()) {
if (this.permissionsFor(member).hasPermission('READ_MESSAGES')) {
members.set(member.id, member);
}
}
return members;
}
// These are here only for documentation purposes - they are implemented by TextBasedChannel
sendMessage() { return; }
sendTTSMessage() { return; }