effectivePermissions property
Future<Permissions>
effectivePermissions
Returns total permissions of user.
Implementation
Future<Permissions> get effectivePermissions async {
final guildInstance = await guild.getOrDownload();
final owner = await guildInstance.owner.getOrDownload();
if (this == owner) {
return Permissions.all();
}
var total = guildInstance.everyoneRole.permissions.raw;
for (final role in roles) {
final roleInstance = await role.getOrDownload();
total |= roleInstance.permissions.raw;
if (PermissionsUtils.isApplied(total, PermissionsConstants.administrator)) {
return Permissions.fromInt(PermissionsConstants.allPermissions);
}
}
return Permissions.fromInt(total);
}