feature: Add DefaultArchiveDuration to ITextChannel (#2295)
This commit is contained in:
@@ -35,6 +35,17 @@ namespace Discord
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
int SlowModeInterval { get; }
|
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>
|
/// <summary>
|
||||||
/// Bulk-deletes multiple messages.
|
/// Bulk-deletes multiple messages.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -66,5 +66,8 @@ namespace Discord.API
|
|||||||
|
|
||||||
[JsonProperty("member_count")]
|
[JsonProperty("member_count")]
|
||||||
public Optional<int> MemberCount { get; set; }
|
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; }
|
public virtual int SlowModeInterval { get; private set; }
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public ulong? CategoryId { get; private set; }
|
public ulong? CategoryId { get; private set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Mention => MentionUtils.MentionChannel(Id);
|
public string Mention => MentionUtils.MentionChannel(Id);
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool IsNsfw { get; private set; }
|
public bool IsNsfw { get; private set; }
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ThreadArchiveDuration DefaultArchiveDuration { get; private set; }
|
||||||
|
|
||||||
internal RestTextChannel(BaseDiscordClient discord, IGuild guild, ulong id)
|
internal RestTextChannel(BaseDiscordClient discord, IGuild guild, ulong id)
|
||||||
: base(discord, guild, id)
|
: base(discord, guild, id)
|
||||||
@@ -46,6 +47,12 @@ namespace Discord.Rest
|
|||||||
if (model.SlowMode.IsSpecified)
|
if (model.SlowMode.IsSpecified)
|
||||||
SlowModeInterval = model.SlowMode.Value;
|
SlowModeInterval = model.SlowMode.Value;
|
||||||
IsNsfw = model.Nsfw.GetValueOrDefault();
|
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 />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ namespace Discord.WebSocket
|
|||||||
private bool _nsfw;
|
private bool _nsfw;
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool IsNsfw => _nsfw;
|
public bool IsNsfw => _nsfw;
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ThreadArchiveDuration DefaultArchiveDuration { get; private set; }
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Mention => MentionUtils.MentionChannel(Id);
|
public string Mention => MentionUtils.MentionChannel(Id);
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -76,6 +77,11 @@ namespace Discord.WebSocket
|
|||||||
Topic = model.Topic.GetValueOrDefault();
|
Topic = model.Topic.GetValueOrDefault();
|
||||||
SlowModeInterval = model.SlowMode.GetValueOrDefault(); // some guilds haven't been patched to include this yet?
|
SlowModeInterval = model.SlowMode.GetValueOrDefault(); // some guilds haven't been patched to include this yet?
|
||||||
_nsfw = model.Nsfw.GetValueOrDefault();
|
_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 />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ namespace Discord
|
|||||||
{
|
{
|
||||||
public bool IsNsfw => throw new NotImplementedException();
|
public bool IsNsfw => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public ThreadArchiveDuration DefaultArchiveDuration => throw new NotImplementedException();
|
||||||
|
|
||||||
public string Topic => throw new NotImplementedException();
|
public string Topic => throw new NotImplementedException();
|
||||||
|
|
||||||
public int SlowModeInterval => throw new NotImplementedException();
|
public int SlowModeInterval => throw new NotImplementedException();
|
||||||
|
|||||||
Reference in New Issue
Block a user