feature: Add DefaultArchiveDuration to ITextChannel (#2295)
This commit is contained in:
@@ -35,6 +35,17 @@ namespace Discord
|
||||
/// </returns>
|
||||
int SlowModeInterval { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default auto-archive duration for client-created threads in this channel.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The value of this property does not affect API thread creation, it will not respect this value.
|
||||
/// </remarks>
|
||||
/// <returns>
|
||||
/// The default auto-archive duration for thread creation in this channel.
|
||||
/// </returns>
|
||||
ThreadArchiveDuration DefaultArchiveDuration { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Bulk-deletes multiple messages.
|
||||
/// </summary>
|
||||
|
||||
@@ -66,5 +66,8 @@ namespace Discord.API
|
||||
|
||||
[JsonProperty("member_count")]
|
||||
public Optional<int> MemberCount { get; set; }
|
||||
|
||||
[JsonProperty("default_auto_archive_duration")]
|
||||
public Optional<ThreadArchiveDuration> AutoArchiveDuration { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,11 +21,12 @@ namespace Discord.Rest
|
||||
public virtual int SlowModeInterval { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public ulong? CategoryId { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Mention => MentionUtils.MentionChannel(Id);
|
||||
/// <inheritdoc />
|
||||
public bool IsNsfw { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public ThreadArchiveDuration DefaultArchiveDuration { get; private set; }
|
||||
|
||||
internal RestTextChannel(BaseDiscordClient discord, IGuild guild, ulong id)
|
||||
: base(discord, guild, id)
|
||||
@@ -46,6 +47,12 @@ namespace Discord.Rest
|
||||
if (model.SlowMode.IsSpecified)
|
||||
SlowModeInterval = model.SlowMode.Value;
|
||||
IsNsfw = model.Nsfw.GetValueOrDefault();
|
||||
|
||||
if (model.AutoArchiveDuration.IsSpecified)
|
||||
DefaultArchiveDuration = model.AutoArchiveDuration.Value;
|
||||
else
|
||||
DefaultArchiveDuration = ThreadArchiveDuration.OneDay;
|
||||
// basic value at channel creation. Shouldn't be called since guild text channels always have this property
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -40,7 +40,8 @@ namespace Discord.WebSocket
|
||||
private bool _nsfw;
|
||||
/// <inheritdoc />
|
||||
public bool IsNsfw => _nsfw;
|
||||
|
||||
/// <inheritdoc />
|
||||
public ThreadArchiveDuration DefaultArchiveDuration { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Mention => MentionUtils.MentionChannel(Id);
|
||||
/// <inheritdoc />
|
||||
@@ -76,6 +77,11 @@ namespace Discord.WebSocket
|
||||
Topic = model.Topic.GetValueOrDefault();
|
||||
SlowModeInterval = model.SlowMode.GetValueOrDefault(); // some guilds haven't been patched to include this yet?
|
||||
_nsfw = model.Nsfw.GetValueOrDefault();
|
||||
if (model.AutoArchiveDuration.IsSpecified)
|
||||
DefaultArchiveDuration = model.AutoArchiveDuration.Value;
|
||||
else
|
||||
DefaultArchiveDuration = ThreadArchiveDuration.OneDay;
|
||||
// basic value at channel creation. Shouldn't be called since guild text channels always have this property
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace Discord
|
||||
{
|
||||
public bool IsNsfw => throw new NotImplementedException();
|
||||
|
||||
public ThreadArchiveDuration DefaultArchiveDuration => throw new NotImplementedException();
|
||||
|
||||
public string Topic => throw new NotImplementedException();
|
||||
|
||||
public int SlowModeInterval => throw new NotImplementedException();
|
||||
|
||||
Reference in New Issue
Block a user