Webpack build for branch master: 64cbb98fb3

This commit is contained in:
Travis CI 2017-09-11 17:36:34 +00:00
parent ecbfa86120
commit afd4fc8d3e
2 changed files with 46 additions and 3 deletions

View file

@ -5801,7 +5801,7 @@ const Util = __webpack_require__(6);
const Permissions = __webpack_require__(12);
const Collection = __webpack_require__(3);
const Constants = __webpack_require__(0);
const { TypeError } = __webpack_require__(4);
const { Error, TypeError } = __webpack_require__(4);
/**
* Represents a guild channel (e.g. text channels and voice channels).
@ -5860,6 +5860,22 @@ class GuildChannel extends Channel {
return this.guild.channels.get(this.parentID);
}
/**
* If the permissionOverwrites match the parent channel, null if no parent
* @type {?boolean}
* @readonly
*/
get permissionsLocked() {
if (!this.parent) return null;
if (this.permissionOverwrites.size !== this.parent.permissionOverwrites.size) return false;
return !this.permissionOverwrites.find((value, key) => {
const testVal = this.parent.permissionOverwrites.get(key);
return testVal === undefined ||
testVal.denied.bitfield !== value.denied.bitfield ||
testVal.allowed.bitfield !== value.allowed.bitfield;
});
}
/**
* The position of the channel
* @type {number}
@ -5991,6 +6007,21 @@ class GuildChannel extends Channel {
.then(() => this);
}
/**
* Locks in the permission overwrites from the parent channel.
* @returns {Promise<GuildChannel>}
*/
lockPermissions() {
if (!this.parent) return Promise.reject(new Error('GUILD_CHANNEL_ORPHAN'));
const permissionOverwrites = this.parent.permissionOverwrites.map(overwrite => ({
deny: overwrite.denied.bitfield,
allow: overwrite.allowed.bitfield,
id: overwrite.id,
type: overwrite.type,
}));
return this.edit({ permissionOverwrites });
}
/**
* A collection of members that can see this channel, mapped by their ID
* @type {Collection<Snowflake, GuildMember>}
@ -6016,6 +6047,16 @@ class GuildChannel extends Channel {
* @property {number} [userLimit] The user limit of the voice channel
* @property {Snowflake} [parentID] The parent ID of the channel
* @property {boolean} [lockPermissions] Lock the permissions of the channel to what the parent's permissions are
* @property {OverwriteData[]} [permissionOverwrites] An array of overwrites to set for the channel
*/
/**
* The data for a permission overwrite
* @typedef {Object} OverwriteData
* @property {string} id The id of the overwrite
* @property {string} type The type of the overwrite, either role or member
* @property {number} allow The bitfield for the allowed permissions
* @property {number} deny The bitfield for the denied permissions
*/
/**
@ -6034,11 +6075,12 @@ class GuildChannel extends Channel {
data: {
name: (data.name || this.name).trim(),
topic: data.topic,
position: data.position || this.position,
position: data.position || this.rawPosition,
bitrate: data.bitrate || (this.bitrate ? this.bitrate * 1000 : undefined),
user_limit: data.userLimit != null ? data.userLimit : this.userLimit, // eslint-disable-line eqeqeq
parent_id: data.parentID,
lock_permissions: data.lockPermissions,
permission_overwrites: data.permissionOverwrites,
},
reason,
}).then(newData => {
@ -22457,6 +22499,7 @@ const Messages = {
MESSAGE_SPLIT_MISSING: 'Message exceeds the max length and contains no split characters.',
GUILD_CHANNEL_RESOLVE: 'Could not resolve channel to a guild channel.',
GUILD_CHANNEL_ORPHAN: 'Could not find a parent to this guild channel.',
GUILD_OWNED: 'Guild is owned by the client.',
GUILD_RESTRICTED: (state = false) => `Guild is ${state ? 'already' : 'not'} restricted.`,
GUILD_MEMBERS_TIMEOUT: 'Members didn\'t arrive in time.',

File diff suppressed because one or more lines are too long