This repository has been archived by the owner on Jul 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
[actions] havePermission
Thedark1337 edited this page Sep 20, 2016
·
4 revisions
Check if a user's permission matches the permission
ID of the user.
The permission to check (one of the following):
PlugAPI.ROOM_ROLE.NONE
PlugAPI.ROOM_ROLE.RESIDENTDJ
PlugAPI.ROOM_ROLE.BOUNCER
PlugAPI.ROOM_ROLE.MANAGER
PlugAPI.ROOM_ROLE.COHOST
PlugAPI.ROOM_ROLE.HOST
Whether to only check for global permission (BA / Admin) or to check both (Default is false)
true
if user's permission matches; otherwise it returns false
Note: If utilizing plugAPI's command handler it would be data.havePermission
and checks for both normal roles and global roles and also includes an optional callback function.
// Check for Bouncer & above permissions
if (bot.havePermission(1234567, PlugAPI.ROOM_ROLE.BOUNCER)) {
// code here
}
// Check for BA / Admin only
if (bot.havePermission(1234567, PlugAPI.ROOM_ROLE.BOUNCER, true)) {
// code here
}