diff --git a/src/Discord.Net.Core/Entities/Guilds/AutoModeration/AutoModTriggerType.cs b/src/Discord.Net.Core/Entities/Guilds/AutoModeration/AutoModTriggerType.cs index 8922d697a..0c3eb2322 100644 --- a/src/Discord.Net.Core/Entities/Guilds/AutoModeration/AutoModTriggerType.cs +++ b/src/Discord.Net.Core/Entities/Guilds/AutoModeration/AutoModTriggerType.cs @@ -12,23 +12,28 @@ namespace Discord public enum AutoModTriggerType { /// - /// Check if content contains words from a user defined list of keywords + /// Check if content contains words from a user defined list of keywords. /// Keyword = 1, /// - /// Check if content contains any harmful links + /// Check if content contains any harmful links. /// HarmfulLink = 2, /// - /// Check if content represents generic spam + /// Check if content represents generic spam. /// Spam = 3, /// - /// Check if content contains words from internal pre-defined wordsets + /// Check if content contains words from internal pre-defined wordsets. /// KeywordPreset = 4, + + /// + /// Check if content contains more unique mentions than allowed. + /// + MentionSpam = 5, } } diff --git a/src/Discord.Net.Core/Entities/Guilds/AutoModeration/IAutoModRule.cs b/src/Discord.Net.Core/Entities/Guilds/AutoModeration/IAutoModRule.cs index b28cc7c05..cf51bab3f 100644 --- a/src/Discord.Net.Core/Entities/Guilds/AutoModeration/IAutoModRule.cs +++ b/src/Discord.Net.Core/Entities/Guilds/AutoModeration/IAutoModRule.cs @@ -45,6 +45,24 @@ namespace Discord /// public IReadOnlyCollection KeywordFilter { get; } + /// + /// Gets regex patterns for this rule. + /// + /// + /// This collection will be empty if is not + /// . + /// + public IReadOnlyCollection RegexPatterns { get; } + + /// + /// Gets the allow list patterns for this rule. + /// + /// + /// This collection will be empty if is not + /// . + /// + public IReadOnlyCollection AllowList { get; } + /// /// Gets the preset keyword types for this rule. /// @@ -54,6 +72,15 @@ namespace Discord /// public IReadOnlyCollection Presets { get; } + /// + /// Gets the total mention limit for this rule. + /// + /// + /// This collection will be empty if is not + /// . + /// + public int MentionTotalLimit { get; } + /// /// Gets a collection of actions that will be preformed if a user breaks this rule. /// diff --git a/src/Discord.Net.Rest/API/Common/TriggerMetadata.cs b/src/Discord.Net.Rest/API/Common/TriggerMetadata.cs index c10108459..6b4aa0a66 100644 --- a/src/Discord.Net.Rest/API/Common/TriggerMetadata.cs +++ b/src/Discord.Net.Rest/API/Common/TriggerMetadata.cs @@ -12,7 +12,16 @@ namespace Discord.API [JsonProperty("keyword_filter")] public string[] KeywordFilter { get; set; } + [JsonProperty("regex_patterns")] + public string[] RegexPatterns { get; set; } + [JsonProperty("presets")] public KeywordPresetTypes[] Presets { get; set; } + + [JsonProperty("allow_list")] + public string[] AllowList { get; set; } + + [JsonProperty("mention_total_limit")] + public int MentionLimit { get; set; } } } diff --git a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs index 468ce5e79..3a01adc95 100644 --- a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs +++ b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs @@ -1062,7 +1062,7 @@ namespace Discord.Rest #endregion #region Auto Mod - public static Task ModifyRuleAsync(BaseDiscordClient client, IAutoModRule rule, Action func, RequestOptions options) + public static Task ModifyRuleAsync(BaseDiscordClient client, IAutoModRule rule, Action func, RequestOptions options) { var args = new AutoModRuleProperties(); func(args); diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketAutoModRule.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketAutoModRule.cs index 5dab651f8..78b0572ae 100644 --- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketAutoModRule.cs +++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketAutoModRule.cs @@ -33,12 +33,21 @@ namespace Discord.WebSocket /// public IReadOnlyCollection KeywordFilter { get; private set; } + /// + public IReadOnlyCollection RegexPatterns { get; private set; } + + /// + public IReadOnlyCollection AllowList { get; private set; } + /// public IReadOnlyCollection Presets { get; private set; } /// public IReadOnlyCollection Actions { get; private set; } + /// + public int MentionTotalLimit { get; private set; } + /// public bool Enabled { get; private set; } @@ -80,6 +89,9 @@ namespace Discord.WebSocket TriggerType = model.TriggerType; KeywordFilter = model.TriggerMetadata.KeywordFilter.ToImmutableArray(); Presets = model.TriggerMetadata.Presets.ToImmutableArray(); + RegexPatterns = model.TriggerMetadata.RegexPatterns.ToImmutableArray(); + AllowList = model.TriggerMetadata.AllowList.ToImmutableArray(); + MentionTotalLimit = model.TriggerMetadata.MentionLimit; Actions = model.Actions.Select(x => new AutoModRuleAction(x.Type, x.Metadata.GetValueOrDefault()?.ChannelId.ToNullable(), x.Metadata.GetValueOrDefault()?.DurationSeconds.ToNullable())).ToImmutableArray(); Enabled = model.Enabled; ExemptRoles = model.ExemptRoles.Select(x => Guild.GetRole(x)).ToImmutableArray();