diff --git a/src/Discord.Net.Core/Entities/Channels/IThreadChannel.cs b/src/Discord.Net.Core/Entities/Channels/IThreadChannel.cs index 72afcad7f..52df07dcc 100644 --- a/src/Discord.Net.Core/Entities/Channels/IThreadChannel.cs +++ b/src/Discord.Net.Core/Entities/Channels/IThreadChannel.cs @@ -111,5 +111,16 @@ namespace Discord /// A task that represents the asynchronous operation of removing a user from this thread. /// Task RemoveUserAsync(IGuildUser user, RequestOptions options = null); + + /// + /// Modifies this thread channel. + /// + /// The delegate containing the properties to modify the channel with. + /// The options to be used when sending the request. + /// + /// A task that represents the asynchronous modification operation. + /// + /// + Task ModifyAsync(Action func, RequestOptions options = null); } } diff --git a/src/Discord.Net.Core/Entities/Channels/TextChannelProperties.cs b/src/Discord.Net.Core/Entities/Channels/TextChannelProperties.cs index 6c8c24420..acd69f480 100644 --- a/src/Discord.Net.Core/Entities/Channels/TextChannelProperties.cs +++ b/src/Discord.Net.Core/Entities/Channels/TextChannelProperties.cs @@ -40,25 +40,10 @@ namespace Discord /// Thrown if the value does not fall within [0, 21600]. public Optional SlowModeInterval { get; set; } - /// - /// Gets or sets whether or not the thread is archived. - /// - public Optional Archived { get; set; } - - /// - /// Gets or sets whether or not the thread is locked. - /// - public Optional Locked { get; set; } - /// /// Gets or sets the auto archive duration. /// public Optional AutoArchiveDuration { get; set; } - /// - /// Gets or sets the tags applied to a forum thread - /// - public Optional> AppliedTags { get; set; } - } } diff --git a/src/Discord.Net.Core/Entities/Channels/ThreadChannelProperties.cs b/src/Discord.Net.Core/Entities/Channels/ThreadChannelProperties.cs new file mode 100644 index 000000000..af5c44129 --- /dev/null +++ b/src/Discord.Net.Core/Entities/Channels/ThreadChannelProperties.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; + +namespace Discord; + + +/// +/// Provides properties that are used to modify an with the specified changes. +/// +/// +public class ThreadChannelProperties : TextChannelProperties +{ + /// + /// Gets or sets the tags applied to a forum thread + /// + public Optional> AppliedTags { get; set; } + + /// + /// Gets or sets whether or not the thread is locked. + /// + public Optional Locked { get; set; } + + /// + /// Gets or sets whether or not the thread is archived. + /// + public Optional Archived { get; set; } +} diff --git a/src/Discord.Net.Rest/Entities/Channels/RestThreadChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestThreadChannel.cs index 223eed3dc..c1be5182e 100644 --- a/src/Discord.Net.Rest/Entities/Channels/RestThreadChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/RestThreadChannel.cs @@ -114,6 +114,13 @@ namespace Discord.Rest Update(model); } + /// + public async Task ModifyAsync(Action func, RequestOptions options = null) + { + var model = await ThreadHelper.ModifyAsync(this, Discord, func, options); + Update(model); + } + /// /// /// This method is not supported in threads. diff --git a/src/Discord.Net.Rest/Entities/Channels/ThreadHelper.cs b/src/Discord.Net.Rest/Entities/Channels/ThreadHelper.cs index 1037329b9..574b12491 100644 --- a/src/Discord.Net.Rest/Entities/Channels/ThreadHelper.cs +++ b/src/Discord.Net.Rest/Entities/Channels/ThreadHelper.cs @@ -46,10 +46,10 @@ namespace Discord.Rest } public static async Task ModifyAsync(IThreadChannel channel, BaseDiscordClient client, - Action func, + Action func, RequestOptions options) { - var args = new TextChannelProperties(); + var args = new ThreadChannelProperties(); func(args); var apiArgs = new ModifyThreadParams { diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketThreadChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketThreadChannel.cs index ec4b53fd2..d9d54f91e 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketThreadChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketThreadChannel.cs @@ -342,6 +342,10 @@ namespace Discord.WebSocket public override Task ModifyAsync(Action func, RequestOptions options = null) => ThreadHelper.ModifyAsync(this, Discord, func, options); + /// + public Task ModifyAsync(Action func, RequestOptions options = null) + => ThreadHelper.ModifyAsync(this, Discord, func, options); + /// /// /// This method is not supported in threads.