AutoMod custom block message (#2613)

This commit is contained in:
Misha133
2023-02-26 22:47:13 +03:00
committed by GitHub
parent 11481a159e
commit 709364aaef
8 changed files with 64 additions and 14 deletions

View File

@@ -21,16 +21,23 @@ namespace Discord
/// </summary>
public ulong? ChannelId { get; }
/// <summary>
/// Gets the custom message that will be shown to members whenever their message is blocked.
/// <see langword="null"/> if no message has been set.
/// </summary>
public Optional<string> CustomMessage { get; set; }
/// <summary>
/// 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; }
internal AutoModRuleAction(AutoModActionType type, ulong? channelId, int? duration)
internal AutoModRuleAction(AutoModActionType type, ulong? channelId, int? duration, string customMessage)
{
Type = type;
ChannelId = channelId;
TimeoutDuration = duration.HasValue ? TimeSpan.FromSeconds(duration.Value) : null;
CustomMessage = customMessage;
}
}
}

View File

@@ -66,6 +66,12 @@ namespace Discord
/// </summary>
public const int MaxTimeoutSeconds = 2419200;
/// <summary>
/// Returns the max custom message length AutoMod rule action allowed by Discord.
/// </summary>
public const int MaxCustomBlockMessageLength = 50;
/// <summary>
/// Gets or sets the name for the rule.
/// </summary>
@@ -146,6 +152,11 @@ namespace Discord
/// Gets or sets the duration of which a user will be timed out for breaking this rule.
/// </summary>
public TimeSpan? TimeoutDuration { get; set; }
/// <summary>
/// Gets or sets the custom message that will be shown to members whenever their message is blocked.
/// </summary>
public Optional<string> CustomMessage { get; set; }
}
}