setMentionable method

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

Modifies the mentionable of the role from bool.

Example :

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

Implementation

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

  if (response.statusCode == 200) {
    _mentionable = mentionable;
  }
}