Class: PermissionsManager

PermissionsManager()

Handles permissions depending on roles.

Constructor

new PermissionsManager()

Source:

Members

adminRoles :Array.<string>

Array of admin role names
Type:
  • Array.<string>
Source:

admins :Array.<string>

Array of admin user IDs
Type:
  • Array.<string>
Source:

djRoles :Array.<string>

Array of DJ role names
Type:
  • Array.<string>
Source:

owner :Array.<string>

Array of owner user IDs
Type:
  • Array.<string>
Source:

Methods

hasRoles(roles, user, guild) → {boolean}

Checks if a user has certain roles (by name). Note: Only one of the roles passed is required for this to return a positive value.
Parameters:
Name Type Description
roles string | Array.<string> Role name(s) to check.
user Discord.GuildMember | Discord.User The user to check. Can also be a Discord.GuildMember.
guild Discord.Guild The guild to check. Not needed if user is a GuildMember.
Source:
Returns:
Type
boolean

isAdmin(user, guild, globalOnly) → {boolean}

Checks if a user has admin rights.
Parameters:
Name Type Description
user Discord.GuildMember | Discord.User The user to check. Can also be a Discord.GuildMember.
guild Discord.Guild The guild to check. Not needed if user is a GuildMember.
globalOnly boolean Check only for global admins.
Source:
Returns:
Type
boolean

isDJ(user, guild) → {boolean}

Checks if a user has DJ roles.
Parameters:
Name Type Description
user Discord.GuildMember | object The user to check. Can also be a Discord.GuildMember.
guild Duscord.Guild The guild to check. Not needed if user is a GuildMember.
Source:
Returns:
Type
boolean

isGuildOwner(user, guild) → {boolean}

Checks if a user is the guild owner.
Parameters:
Name Type Description
user Discord.GuildMember | Discord.User The user or member to check
guild Discord.Guild The guild to check
Source:
Returns:
Type
boolean

isOwner(user) → {boolean}

Check if a user is the bot owner
Parameters:
Name Type Description
user Discord.User User to check
Source:
Returns:
Type
boolean