setPermissions method

Future<void> setPermissions(
  1. List<ClientPermission> permissions, {
  2. String? reason,
})

Modifies the permissions associated with this

Example :

import 'package:mineral/api.dart'; 👈 // then you can use Permission class

final Role? role = guild.roles.cache.get('240561194958716924');
if (role != null) {
  await role.setPermissions([Permission.kickMembers, Permission.banMembers]);
}

Implementation

Future<void> setPermissions (List<ClientPermission> permissions, { String? reason }) async {

  int _permissions = Helper.reduceRolePermissions(permissions);
  Response response = await ioc.use<DiscordApiHttpService>().patch(url: "/guilds/${manager.guild.id}/roles/$id")
    .payload({ 'permissions': _permissions })
    .auditLog(reason)
    .build();


  if (response.statusCode == 200) {
    this._permissions = _permissions;
  }
}