setExemptRoles method
Defines which roles will not be affected by this
Example :
final role = guild.roles.cache.get('240561194958716924');
if (role != null) {
await rule.setExemptRoles([role]);
}
Implementation
Future<void> setExemptRoles(List<Role> roles) async {
int maxItems = 50;
if (roles.length > maxItems) {
TooManyException("The list of roles cannot exceed $maxItems items (currently ${roles.length} given)");
}
Response response = await ioc.use<HttpService>().patch(url: "/guilds/$guildId/auto-moderation/rules/$id", payload: {
'exempt_roles': roles.map((Role role) => role.id)
});
if (response.statusCode == 200) {
exemptRoles = roles;
}
}