setHoist method

Future<void> setHoist(
  1. bool hoist, {
  2. String? reason,
})

Modifies the hoist of the role from bool.

Example :

final Role? role = guild.roles.cache.get('240561194958716924');
if (role != null) {
  await role.setHoist(true);
}

Implementation

Future<void> setHoist (bool hoist, { String? reason }) async {
  Response response = await ioc.use<DiscordApiHttpService>().patch(url: "/guilds/${manager.guild.id}/roles/$id")
    .payload({ 'hoist': hoist })
    .auditLog(reason)
    .build();

  if (response.statusCode == 200) {
    _hoist = hoist;
  }
}