Clean up a bunch of stuff

- Channel typing data is now a Map
- Client properties on structures are now non-enumerable and
non-configurable
This commit is contained in:
Schuyler Cebulskie
2016-09-07 00:24:45 -04:00
parent 3a790e74f4
commit b7f582b7f0
22 changed files with 411 additions and 316 deletions

View File

@@ -11,11 +11,14 @@ class Emoji {
* @type {Client}
*/
this.client = guild.client;
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
/**
* The Guild this emoji is part of
* @type {Guild}
*/
this.guild = guild;
this.setup(data);
}
@@ -25,22 +28,26 @@ class Emoji {
* @type {string}
*/
this.id = data.id;
/**
* The name of the Emoji
* @type {string}
*/
this.name = data.name;
this.roleIDS = data.roles;
/**
* Whether or not this emoji requires colons surrounding it
* @type {boolean}
*/
this.requiresColons = data.require_colons;
/**
* Whether this emoji is managed by an external service
* @type {boolean}
*/
this.managed = data.managed;
this._roles = data.roles;
}
/**
@@ -59,8 +66,8 @@ class Emoji {
*/
get roles() {
const roles = new Collection();
for (const role of this.roleIDS) {
if (this.guild.roles.get(role)) roles.set(role, this.guild.roles.get(role));
for (const role of this._roles) {
if (this.guild.roles.has(role)) roles.set(role, this.guild.roles.get(role));
}
return roles;
}