diff options
| author | Alee14 <Alee14498@gmail.com> | 2017-07-28 16:20:27 -0400 |
|---|---|---|
| committer | Alee14 <Alee14498@gmail.com> | 2017-07-28 16:20:27 -0400 |
| commit | d35e0862e6b60fe3c4f823371627359f3ce3e68b (patch) | |
| tree | d98b788eb1abf0a8814207b993b4e22efe711deb /node_modules/discord.js/src/structures/EvaluatedPermissions.js | |
| parent | 20993df62e7e38ed43428aafa5981afc3543bdea (diff) | |
| download | AleeBot-d35e0862e6b60fe3c4f823371627359f3ce3e68b.tar.gz AleeBot-d35e0862e6b60fe3c4f823371627359f3ce3e68b.tar.bz2 AleeBot-d35e0862e6b60fe3c4f823371627359f3ce3e68b.zip | |
Removing node modules (go get them yourself :P)
Diffstat (limited to 'node_modules/discord.js/src/structures/EvaluatedPermissions.js')
| -rw-r--r-- | node_modules/discord.js/src/structures/EvaluatedPermissions.js | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/node_modules/discord.js/src/structures/EvaluatedPermissions.js b/node_modules/discord.js/src/structures/EvaluatedPermissions.js deleted file mode 100644 index ae8a643..0000000 --- a/node_modules/discord.js/src/structures/EvaluatedPermissions.js +++ /dev/null @@ -1,67 +0,0 @@ -const Constants = require('../util/Constants'); - -/** - * The final evaluated permissions for a member in a channel - */ -class EvaluatedPermissions { - constructor(member, raw) { - /** - * The member this permissions refer to - * @type {GuildMember} - */ - this.member = member; - - /** - * A number representing the packed permissions - * @type {number} - */ - this.raw = raw; - } - - /** - * Get an object mapping permission name, e.g. `READ_MESSAGES` to a boolean - whether the user - * can perform this or not. - * @returns {Object<string, boolean>} - */ - serialize() { - const serializedPermissions = {}; - for (const permissionName in Constants.PermissionFlags) { - serializedPermissions[permissionName] = this.hasPermission(permissionName); - } - return serializedPermissions; - } - - /** - * Checks whether the user has a certain permission, e.g. `READ_MESSAGES`. - * @param {PermissionResolvable} permission The permission to check for - * @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permission - * @returns {boolean} - */ - hasPermission(permission, explicit = false) { - permission = this.member.client.resolver.resolvePermission(permission); - if (!explicit && (this.raw & Constants.PermissionFlags.ADMINISTRATOR) > 0) return true; - return (this.raw & permission) > 0; - } - - /** - * Checks whether the user has all specified permissions. - * @param {PermissionResolvable[]} permissions The permissions to check for - * @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permissions - * @returns {boolean} - */ - hasPermissions(permissions, explicit = false) { - return permissions.every(p => this.hasPermission(p, explicit)); - } - - /** - * Checks whether the user has all specified permissions, and lists any missing permissions. - * @param {PermissionResolvable[]} permissions The permissions to check for - * @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permissions - * @returns {PermissionResolvable[]} - */ - missingPermissions(permissions, explicit = false) { - return permissions.filter(p => !this.hasPermission(p, explicit)); - } -} - -module.exports = EvaluatedPermissions; |
