setPermissions method

Future<void> setPermissions(
  1. List<Permission> permissions
)

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<Permission> permissions) async {

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

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