mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
Fix docs generator and add EvaluatedPermissions.hasPermissions()
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -42,6 +42,16 @@ class EvaluatedPermissions {
|
|||||||
if (!explicit && (this.raw & Constants.PermissionFlags.ADMINISTRATOR) > 0) return true;
|
if (!explicit && (this.raw & Constants.PermissionFlags.ADMINISTRATOR) > 0) return true;
|
||||||
return (this.raw & permission) > 0;
|
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;
|
module.exports = EvaluatedPermissions;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class TextChannel extends GuildChannel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A collection of members that can see this channel, mapped by their ID.
|
* A collection of members that can see this channel, mapped by their ID.
|
||||||
* @returns {Collection<string, GuildMember>}
|
* @type {Collection<string, GuildMember>}
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get members() {
|
get members() {
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ client.on('ready', () => {
|
|||||||
console.log('ready!');
|
console.log('ready!');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
client.on('guildMemberAdd', (g, m) => {
|
||||||
|
console.log(`${m.user.username} joined ${g.name}`);
|
||||||
|
})
|
||||||
|
|
||||||
client.on('debug', console.log);
|
client.on('debug', console.log);
|
||||||
|
|
||||||
client.on('message', message => {
|
client.on('message', message => {
|
||||||
|
|||||||
Reference in New Issue
Block a user