ModerationRulesBuilder.spam constructor
ModerationRulesBuilder.spam({})
Create a new moderation rule for Guild that triggers when a user spam many messages.
Implementation
factory ModerationRulesBuilder.spam ({ required String label, required List<ModerationAction> actions, 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.spam,
exemptRoles ?? [],
exemptChannels ?? [],
enabled,
actions,
null
);
}