Permissions

Basic Help page for using permissions in phpcord

Create a simple permission

$permission = new Permission();

Add allowed fields to the permission

When setting guild wide permissions, you'll use this

$permission->addAllow(ADMINISTRATOR);
$permission->addAllow(SEND_MESSAGES);

Instead of using defined constants, you can also use class constants as well. Take a look at PermissionIds for a quick instruction. Example:

$permission->addAllow(PermissionIds::ADMINISTRATOR);

Add denied fields to the permission

This will not work when setting guild wide permissions to a Role

=> If a role shouldn't do something, just don't add it

$permission->addDeny(SEND_MESSAGES);
$permission->addAllow(READ_MESSAGE_HISTORY);

Using PermissionIds is equaling to the description above

Last updated