[Features] Automod member profile moderation, new application fields, use clyde ai & guild invenory settings (#2791)

* guild inventory settings

* `UseClydeAI` (1L << 47) permission

* automod member profile moderation

* Dnet: The Enums update (new application fields)

* ah yeah, `IApplication`

* some oversights

* y did I change this

* oh bruh nvm

* `CreateGuildExpressions` permission

---------

Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com>
This commit is contained in:
Mihail Gribkov
2023-11-19 00:15:20 +03:00
committed by GitHub
parent 89bebc361a
commit 699554ad11
28 changed files with 680 additions and 107 deletions

View File

@@ -457,7 +457,7 @@ namespace Discord.Rest
AvailableTags = props.Tags.GetValueOrDefault(Array.Empty<ForumTagProperties>()).Select(
x => new ModifyForumTagParams
{
Id = x.Id,
Id = x.Id ?? Optional<ulong>.Unspecified,
Name = x.Name,
EmojiId = x.Emoji is Emote emote
? emote.Id
@@ -1197,8 +1197,8 @@ namespace Discord.Rest
if (args.RegexPatterns.IsSpecified)
{
if (args.TriggerType.Value is not AutoModTriggerType.Keyword)
throw new ArgumentException(message: $"Regex patterns can only be used with 'Keyword' trigger type.", paramName: nameof(args.RegexPatterns));
if (args.TriggerType.Value is not AutoModTriggerType.Keyword and not AutoModTriggerType.MemberProfile)
throw new ArgumentException(message: $"Regex patterns can only be used with 'Keyword' or 'MemberProfile' trigger type.", paramName: nameof(args.RegexPatterns));
Preconditions.AtMost(args.RegexPatterns.Value.Length, AutoModRuleProperties.MaxRegexPatternCount, nameof(args.RegexPatterns), $"Regex pattern count must be less than or equal to {AutoModRuleProperties.MaxRegexPatternCount}.");
@@ -1208,8 +1208,8 @@ namespace Discord.Rest
if (args.KeywordFilter.IsSpecified)
{
if (args.TriggerType.Value != AutoModTriggerType.Keyword)
throw new ArgumentException(message: $"Keyword filter can only be used with 'Keyword' trigger type.", paramName: nameof(args.KeywordFilter));
if (args.TriggerType.Value is not AutoModTriggerType.Keyword and not AutoModTriggerType.MemberProfile)
throw new ArgumentException(message: $"Keyword filter can only be used with 'Keyword' or 'MemberProfile' trigger type.", paramName: nameof(args.KeywordFilter));
Preconditions.AtMost(args.KeywordFilter.Value.Length, AutoModRuleProperties.MaxKeywordCount, nameof(args.KeywordFilter), $"Keyword count must be less than or equal to {AutoModRuleProperties.MaxKeywordCount}");
@@ -1222,8 +1222,8 @@ namespace Discord.Rest
if (args.AllowList.IsSpecified)
{
if (args.TriggerType.Value is not AutoModTriggerType.Keyword or AutoModTriggerType.KeywordPreset)
throw new ArgumentException(message: $"Allow list can only be used with 'Keyword' or 'KeywordPreset' trigger type.", paramName: nameof(args.AllowList));
if (args.TriggerType.Value is not AutoModTriggerType.Keyword and not AutoModTriggerType.KeywordPreset and not AutoModTriggerType.MemberProfile)
throw new ArgumentException(message: $"Allow list can only be used with 'Keyword', 'KeywordPreset' or 'MemberProfile' trigger type.", paramName: nameof(args.AllowList));
if (args.TriggerType.Value is AutoModTriggerType.Keyword)
Preconditions.AtMost(args.AllowList.Value.Length, AutoModRuleProperties.MaxAllowListCountKeyword, nameof(args.AllowList), $"Allow list entry count must be less than or equal to {AutoModRuleProperties.MaxAllowListCountKeyword}.");
@@ -1258,7 +1258,7 @@ namespace Discord.Rest
if (args.ExemptChannels.IsSpecified)
Preconditions.AtMost(args.ExemptChannels.Value.Length, AutoModRuleProperties.MaxExemptChannels, nameof(args.ExemptChannels), $"Exempt channels count must be less than or equal to {AutoModRuleProperties.MaxExemptChannels}.");
if (!args.Actions.IsSpecified && args.Actions.Value.Length == 0)
if (!args.Actions.IsSpecified || args.Actions.Value.Length == 0)
{
throw new ArgumentException(message: $"At least 1 action must be set for an auto moderation rule.", paramName: nameof(args.Actions));
}