ModerationRulesBuilder.mentionSpam constructor
ModerationRulesBuilder.mentionSpam({
- required String label,
- required List<
ModerationAction> actions, - required ModerationTriggerMetadata? triggerMetadata,
- List<
Snowflake> ? exemptRoles, - List<
Snowflake> ? exemptChannels, - bool enabled = true,
Create a new moderation rule for Guild that triggers when a user MessageMention
many users.
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,
);
}