@@ -35,6 +35,24 @@ namespace Discord | |||||
/// </summary> | /// </summary> | ||||
IReadOnlyCollection<ForumTag> Tags { get; } | IReadOnlyCollection<ForumTag> Tags { get; } | ||||
/// <summary> | |||||
/// Gets the current rate limit on creating posts in this forum channel. | |||||
/// </summary> | |||||
/// <returns> | |||||
/// An <see cref="int"/> representing the time in seconds required before the user can send another | |||||
/// message; <c>0</c> if disabled. | |||||
/// </returns> | |||||
int ThreadCreationInterval { get; } | |||||
/// <summary> | |||||
/// Gets the current default slow-mode delay for threads in this forum channel. | |||||
/// </summary> | |||||
/// <returns> | |||||
/// An <see cref="int"/> representing the time in seconds required before the user can send another | |||||
/// message; <c>0</c> if disabled. | |||||
/// </returns> | |||||
int DefaultSlowModeInterval { get; } | |||||
/// <summary> | /// <summary> | ||||
/// Creates a new post (thread) within the forum. | /// Creates a new post (thread) within the forum. | ||||
/// </summary> | /// </summary> | ||||
@@ -76,5 +76,8 @@ namespace Discord.API | |||||
[JsonProperty("default_auto_archive_duration")] | [JsonProperty("default_auto_archive_duration")] | ||||
public Optional<ThreadArchiveDuration> AutoArchiveDuration { get; set; } | public Optional<ThreadArchiveDuration> AutoArchiveDuration { get; set; } | ||||
[JsonProperty("default_thread_rate_limit_per_user")] | |||||
public Optional<int> ThreadRateLimitPerUser { get; set; } | |||||
} | } | ||||
} | } |
@@ -26,6 +26,12 @@ namespace Discord.Rest | |||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
public IReadOnlyCollection<ForumTag> Tags { get; private set; } | public IReadOnlyCollection<ForumTag> Tags { get; private set; } | ||||
/// <inheritdoc/> | |||||
public int ThreadCreationInterval { get; private set; } | |||||
/// <inheritdoc/> | |||||
public int DefaultSlowModeInterval { get; private set; } | |||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
public string Mention => MentionUtils.MentionChannel(Id); | public string Mention => MentionUtils.MentionChannel(Id); | ||||
@@ -49,6 +55,12 @@ namespace Discord.Rest | |||||
Topic = model.Topic.GetValueOrDefault(); | Topic = model.Topic.GetValueOrDefault(); | ||||
DefaultAutoArchiveDuration = model.AutoArchiveDuration.GetValueOrDefault(ThreadArchiveDuration.OneDay); | DefaultAutoArchiveDuration = model.AutoArchiveDuration.GetValueOrDefault(ThreadArchiveDuration.OneDay); | ||||
if (model.ThreadRateLimitPerUser.IsSpecified) | |||||
DefaultSlowModeInterval = model.ThreadRateLimitPerUser.Value; | |||||
if(model.SlowMode.IsSpecified) | |||||
ThreadCreationInterval = model.SlowMode.Value; | |||||
Tags = model.ForumTags.GetValueOrDefault(Array.Empty<API.ForumTags>()).Select( | Tags = model.ForumTags.GetValueOrDefault(Array.Empty<API.ForumTags>()).Select( | ||||
x => new ForumTag(x.Id, x.Name, x.EmojiId.GetValueOrDefault(null), x.EmojiName.GetValueOrDefault()) | x => new ForumTag(x.Id, x.Name, x.EmojiId.GetValueOrDefault(null), x.EmojiName.GetValueOrDefault()) | ||||
).ToImmutableArray(); | ).ToImmutableArray(); | ||||
@@ -27,6 +27,12 @@ namespace Discord.WebSocket | |||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
public IReadOnlyCollection<ForumTag> Tags { get; private set; } | public IReadOnlyCollection<ForumTag> Tags { get; private set; } | ||||
/// <inheritdoc/> | |||||
public int ThreadCreationInterval { get; private set; } | |||||
/// <inheritdoc/> | |||||
public int DefaultSlowModeInterval { get; private set; } | |||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
public string Mention => MentionUtils.MentionChannel(Id); | public string Mention => MentionUtils.MentionChannel(Id); | ||||
@@ -46,6 +52,12 @@ namespace Discord.WebSocket | |||||
Topic = model.Topic.GetValueOrDefault(); | Topic = model.Topic.GetValueOrDefault(); | ||||
DefaultAutoArchiveDuration = model.AutoArchiveDuration.GetValueOrDefault(ThreadArchiveDuration.OneDay); | DefaultAutoArchiveDuration = model.AutoArchiveDuration.GetValueOrDefault(ThreadArchiveDuration.OneDay); | ||||
if (model.ThreadRateLimitPerUser.IsSpecified) | |||||
DefaultSlowModeInterval = model.ThreadRateLimitPerUser.Value; | |||||
if (model.SlowMode.IsSpecified) | |||||
ThreadCreationInterval = model.SlowMode.Value; | |||||
Tags = model.ForumTags.GetValueOrDefault(Array.Empty<API.ForumTags>()).Select( | Tags = model.ForumTags.GetValueOrDefault(Array.Empty<API.ForumTags>()).Select( | ||||
x => new ForumTag(x.Id, x.Name, x.EmojiId.GetValueOrDefault(null), x.EmojiName.GetValueOrDefault()) | x => new ForumTag(x.Id, x.Name, x.EmojiId.GetValueOrDefault(null), x.EmojiName.GetValueOrDefault()) | ||||
).ToImmutableArray(); | ).ToImmutableArray(); | ||||