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