mirror of
https://github.com/danbulant/discord.js
synced 2026-05-24 20:42:27 +00:00
GuildMember.roles is now a collection instead of an array
This commit is contained in:
parent
59a5862f2d
commit
fced6983d9
2 changed files with 7 additions and 6 deletions
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,5 @@
|
|||
const TextBasedChannel = require('./interface/TextBasedChannel');
|
||||
const Collection = require('../util/Collection');
|
||||
|
||||
/**
|
||||
* Represents a Member of a Guild on Discord
|
||||
|
|
@ -82,22 +83,22 @@ class GuildMember {
|
|||
}
|
||||
|
||||
/**
|
||||
* A list of roles that are applied to this GuildMember
|
||||
* @type {Array<Role>}
|
||||
* A list of roles that are applied to this GuildMember, mapped by the role ID.
|
||||
* @type {Collection<string, Role>}
|
||||
* @readonly
|
||||
*/
|
||||
get roles() {
|
||||
const list = [];
|
||||
const list = new Collection();
|
||||
const everyoneRole = this.guild.roles.get(this.guild.id);
|
||||
|
||||
if (everyoneRole) {
|
||||
list.push(everyoneRole);
|
||||
list.set(everyoneRole.id, everyoneRole);
|
||||
}
|
||||
|
||||
for (const roleID of this._roles) {
|
||||
const role = this.guild.roles.get(roleID);
|
||||
if (role) {
|
||||
list.push(role);
|
||||
list.set(role.id, role);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue