Fix docs generator and add EvaluatedPermissions.hasPermissions()

This commit is contained in:
Amish Shah
2016-09-11 12:44:26 +01:00
parent af33b2b5bb
commit 7933d755be
4 changed files with 16 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@@ -42,6 +42,16 @@ class EvaluatedPermissions {
if (!explicit && (this.raw & Constants.PermissionFlags.ADMINISTRATOR) > 0) return true;
return (this.raw & permission) > 0;
}
/**
* Checks whether a user has multiple permissions in a channel.
* @param {Array<PermissionResolvable>} permissions the permissions to test for
* @param {boolean} [explicit=false] whether to require the user to explicitly have the exact permissions
* @returns {boolean}
*/
hasPermissions(permissions, explicit = false) {
return permissions.map(p => this.hasPermission(p, explicit)).every(v => v);
}
}
module.exports = EvaluatedPermissions;

View File

@@ -29,7 +29,7 @@ class TextChannel extends GuildChannel {
/**
* A collection of members that can see this channel, mapped by their ID.
* @returns {Collection<string, GuildMember>}
* @type {Collection<string, GuildMember>}
* @readonly
*/
get members() {

View File

@@ -14,6 +14,10 @@ client.on('ready', () => {
console.log('ready!');
});
client.on('guildMemberAdd', (g, m) => {
console.log(`${m.user.username} joined ${g.name}`);
})
client.on('debug', console.log);
client.on('message', message => {