Fixed a bunch of ClientUserGuildSettings stuff and its docs (#1758)

This commit is contained in:
SpaceEEC
2017-08-10 01:25:24 +02:00
committed by Crawl
parent 87cdad332c
commit fa5c4efa2b
7 changed files with 38 additions and 25 deletions

View File

@@ -4,8 +4,7 @@ const Constants = require('../util/Constants');
* A wrapper around the ClientUser's channel overrides.
*/
class ClientUserChannelOverride {
constructor(user, data) {
this.user = user;
constructor(data) {
this.patch(data);
}
@@ -14,8 +13,7 @@ class ClientUserChannelOverride {
* @param {Object} data Data to patch this with
*/
patch(data) {
for (const key of Object.keys(Constants.UserChannelOverrideMap)) {
const value = Constants.UserChannelOverrideMap[key];
for (const [key, value] of Object.entries(Constants.UserChannelOverrideMap)) {
if (!data.hasOwnProperty(key)) continue;
if (typeof value === 'function') {
this[value.name] = value(data[key]);