ModerationRulesBuilder.mentionSpam constructor

ModerationRulesBuilder.mentionSpam({
  1. required String label,
  2. required List<ModerationAction> actions,
  3. required ModerationTriggerMetadata? triggerMetadata,
  4. List<Snowflake>? exemptRoles,
  5. List<Snowflake>? exemptChannels,
  6. bool enabled = true,
})

Implementation

factory ModerationRulesBuilder.mentionSpam ({ required String label, required List<ModerationAction> actions, required ModerationTriggerMetadata? triggerMetadata, List<Snowflake>? exemptRoles, List<Snowflake>? exemptChannels, bool enabled = true }) {
  if (exemptRoles != null && exemptRoles.length > 50) {
    throw TooManyException('You cannot define more than 50 roles in the exclusion zone of the moderation rule.');
  }

  if (exemptChannels != null && exemptChannels.length > 20) {
    throw TooManyException('You cannot define more than 20 channels in the exclusion zone of the moderation rule.');
  }

  return ModerationRulesBuilder(
    label,
    ModerationEventType.messageSend,
    ModerationTriggerType.mentionSpam,
    exemptRoles ?? [],
    exemptChannels ?? [],
    enabled,
    actions,
    triggerMetadata,
  );
}