Browse Source

Apply suggestions from code review

pull/2578/head
Casmir GitHub 2 years ago
parent
commit
e364b3ae7c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 21 deletions
  1. +1
    -1
      src/Discord.Net.Core/Entities/Guilds/AutoModeration/AutoModEventType.cs
  2. +6
    -6
      src/Discord.Net.Core/Entities/Guilds/AutoModeration/AutoModRule.cs
  3. +2
    -2
      src/Discord.Net.Core/Entities/Guilds/AutoModeration/AutoModRuleAction.cs
  4. +3
    -3
      src/Discord.Net.Core/Entities/Guilds/AutoModeration/AutoModRuleProperties.cs
  5. +5
    -5
      src/Discord.Net.Core/Entities/Guilds/AutoModeration/IAutoModRule.cs
  6. +1
    -1
      src/Discord.Net.Core/Entities/Guilds/IGuild.cs
  7. +3
    -3
      src/Discord.Net.Rest/DiscordRestApiClient.cs

+ 1
- 1
src/Discord.Net.Core/Entities/Guilds/AutoModeration/AutoModEventType.cs View File

@@ -12,7 +12,7 @@ namespace Discord
public enum AutoModEventType
{
/// <summary>
/// When a member sends or edits a message in the guild
/// When a member sends or edits a message in the guild.
/// </summary>
MessageSend = 1
}


+ 6
- 6
src/Discord.Net.Core/Entities/Guilds/AutoModeration/AutoModRule.cs View File

@@ -32,22 +32,22 @@ namespace Discord
public string[] KeywordFilter { get; }

/// <summary>
/// Gets regex patterns for the rule.
/// Gets regex patterns for the rule. Empty if the rule has no regexes.
/// </summary>
public string[] RegexPatterns { get; }

/// <summary>
/// Gets the allow list for the rule.
/// Gets the allow list for the rule. Empty if the rule has no allowed terms.
/// </summary>
public string[] AllowList { get; }

/// <summary>
/// Gets total mention limit for the rule.
/// Gets total mention limit for the rule. <see langword="null"/> if not provided.
/// </summary>
public int? MentionLimit { get; }

/// <summary>
/// Gets the presets for the rule.
/// Gets the presets for the rule. Empty if the rule has no presets.
/// </summary>
public KeywordPresetTypes[] Presets { get; }

@@ -62,12 +62,12 @@ namespace Discord
public bool Enabled { get; }

/// <summary>
/// Gets the exempt roles for the rule.
/// Gets the exempt roles for the rule. Empty if the rule has no exempt roles.
/// </summary>
public ulong[] ExemptRoles { get; }

/// <summary>
/// Gets the exempt channels for the rule.
/// Gets the exempt channels for the rule. Empty if the rule has no exempt channels.
/// </summary>
public ulong[] ExemptChannels { get; }


+ 2
- 2
src/Discord.Net.Core/Entities/Guilds/AutoModeration/AutoModRuleAction.cs View File

@@ -17,12 +17,12 @@ namespace Discord
public AutoModActionType Type { get; }

/// <summary>
/// Get the channel id on which to post alerts.
/// Get the channel id on which to post alerts. <see langword="null"/> if no channel has been provided.
/// </summary>
public ulong? ChannelId { get; }

/// <summary>
/// Gets the duration of which a user will be timed out for breaking this rule.
/// Gets the duration of which a user will be timed out for breaking this rule. <see langword="null"/> if no timeout duration has been provided.
/// </summary>
public TimeSpan? TimeoutDuration { get; }



+ 3
- 3
src/Discord.Net.Core/Entities/Guilds/AutoModeration/AutoModRuleProperties.cs View File

@@ -47,7 +47,7 @@ namespace Discord
public Optional<int> MentionLimit { get; set; }

/// <summary>
/// Gets or sets the presets for the rule.
/// Gets or sets the presets for the rule. Empty if the rule has no presets.
/// </summary>
public Optional<KeywordPresetTypes[]> Presets { get; set; }

@@ -62,12 +62,12 @@ namespace Discord
public Optional<bool> Enabled { get; set; }

/// <summary>
/// Gets or sets the exempt roles for the rule.
/// Gets or sets the exempt roles for the rule. Empty if the rule has no exempt roles.
/// </summary>
public Optional<ulong[]> ExemptRoles { get; set; }

/// <summary>
/// Gets or sets the exempt channels for the rule.
/// Gets or sets the exempt channels for the rule. Empty if the rule has no exempt channels.
/// </summary>
public Optional<ulong[]> ExemptChannels { get; set; }
}


+ 5
- 5
src/Discord.Net.Core/Entities/Guilds/AutoModeration/IAutoModRule.cs View File

@@ -46,7 +46,7 @@ namespace Discord
public IReadOnlyCollection<string> KeywordFilter { get; }

/// <summary>
/// Gets regex patterns for this rule.
/// Gets regex patterns for this rule. Empty if the rule has no regexes.
/// </summary>
/// <remarks>
/// This collection will be empty if <see cref="TriggerType"/> is not
@@ -55,7 +55,7 @@ namespace Discord
public IReadOnlyCollection<string> RegexPatterns { get; }

/// <summary>
/// Gets the allow list patterns for this rule.
/// Gets the allow list patterns for this rule. Empty if the rule has no allowed terms.
/// </summary>
/// <remarks>
/// This collection will be empty if <see cref="TriggerType"/> is not
@@ -64,7 +64,7 @@ namespace Discord
public IReadOnlyCollection<string> AllowList { get; }

/// <summary>
/// Gets the preset keyword types for this rule.
/// Gets the preset keyword types for this rule. Empty if the rule has no presets.
/// </summary>
/// <remarks>
/// This collection will be empty if <see cref="TriggerType"/> is not
@@ -92,12 +92,12 @@ namespace Discord
bool Enabled { get; }

/// <summary>
/// Gets a collection of role ids that are exempt from this rule.
/// Gets a collection of role ids that are exempt from this rule. Empty if the rule has no exempt roles.
/// </summary>
IReadOnlyCollection<ulong> ExemptRoles { get; }

/// <summary>
/// Gets a collection of channel ids that are exempt from this rule.
/// Gets a collection of channel ids that are exempt from this rule. Empty if the rule has no exempt channels.
/// </summary>
IReadOnlyCollection<ulong> ExemptChannels { get; }



+ 1
- 1
src/Discord.Net.Core/Entities/Guilds/IGuild.cs View File

@@ -1288,7 +1288,7 @@ namespace Discord
/// Creates a new auto moderation rule.
/// </summary>
/// <returns>
/// A task that represents the asynchronous creation operation. The task result contains the created <see cref="WelcomeScreen"/>.
/// A task that represents the asynchronous creation operation. The task result contains the created <see cref="IAutoModRule"/>.
/// </returns>
Task<IAutoModRule> CreateAutoModRuleAsync(AutoModRule props, RequestOptions options = null);
}


+ 3
- 3
src/Discord.Net.Rest/DiscordRestApiClient.cs View File

@@ -2129,7 +2129,7 @@ namespace Discord.API

options = RequestOptions.CreateOrClone(options);

return await SendJsonAsync<AutoModerationRule>("POST", () => $"guilds/{guildId}/auto-moderation/rules", args, new BucketIds(guildId), options: options);
return await SendJsonAsync<AutoModerationRule>("POST", () => $"guilds/{guildId}/auto-moderation/rules", args, new BucketIds(guildId: guildId), options: options);
}

public async Task<AutoModerationRule> ModifyGuildAutoModRuleAsync(ulong guildId, ulong ruleId, ModifyAutoModRuleParams args, RequestOptions options)
@@ -2139,7 +2139,7 @@ namespace Discord.API

options = RequestOptions.CreateOrClone(options);

return await SendJsonAsync<AutoModerationRule>("PATCH", () => $"guilds/{guildId}/auto-moderation/rules/{ruleId}", args, new BucketIds(guildId), options: options);
return await SendJsonAsync<AutoModerationRule>("PATCH", () => $"guilds/{guildId}/auto-moderation/rules/{ruleId}", args, new BucketIds(guildId: guildId), options: options);
}

public async Task DeleteGuildAutoModRuleAsync(ulong guildId, ulong ruleId, RequestOptions options)
@@ -2149,7 +2149,7 @@ namespace Discord.API

options = RequestOptions.CreateOrClone(options);

await SendAsync("DELETE", () => $"guilds/{guildId}/auto-moderation/rules/{ruleId}", new BucketIds(guildId), options: options);
await SendAsync("DELETE", () => $"guilds/{guildId}/auto-moderation/rules/{ruleId}", new BucketIds(guildId: guildId), options: options);
}

#endregion


Loading…
Cancel
Save