diff --git a/src/Disqord.Bot/Bot/Base/Setup/DiscordBotBase.Setup.cs b/src/Disqord.Bot/Bot/Base/Setup/DiscordBotBase.Setup.cs index dc07b4e71..267a0ac6b 100644 --- a/src/Disqord.Bot/Bot/Base/Setup/DiscordBotBase.Setup.cs +++ b/src/Disqord.Bot/Bot/Base/Setup/DiscordBotBase.Setup.cs @@ -148,6 +148,7 @@ protected virtual ValueTask AddTypeParsers(DefaultTypeParserProvider typeParserP typeParserProvider.AddParser(new GuildChannelTypeParser()); typeParserProvider.AddParser(new GuildChannelTypeParser()); typeParserProvider.AddParser(new GuildChannelTypeParser()); + typeParserProvider.AddParser(new GuildChannelTypeParser()); typeParserProvider.AddParser(new MemberTypeParser()); typeParserProvider.AddParser(new RoleTypeParser()); return default; diff --git a/src/Disqord.Core/Entities/Core/Channels/Guild/Forums/IForumChannel.cs b/src/Disqord.Core/Entities/Core/Channels/Guild/Forums/IForumChannel.cs index 708cbaef5..14b7c1a94 100644 --- a/src/Disqord.Core/Entities/Core/Channels/Guild/Forums/IForumChannel.cs +++ b/src/Disqord.Core/Entities/Core/Channels/Guild/Forums/IForumChannel.cs @@ -3,7 +3,7 @@ namespace Disqord; /// /// Represents a guild forum channel. /// -public interface IForumChannel : IThreadParentChannel, ITopicChannel, ISlowmodeChannel +public interface IForumChannel : IMediaChannel { /// /// Gets the default layout of posts in this channel. diff --git a/src/Disqord.Core/Entities/Transient/Channels/Guild/Common/TransientGuildChannel.cs b/src/Disqord.Core/Entities/Transient/Channels/Guild/Common/TransientGuildChannel.cs index af8b468ea..ec84a0827 100644 --- a/src/Disqord.Core/Entities/Transient/Channels/Guild/Common/TransientGuildChannel.cs +++ b/src/Disqord.Core/Entities/Transient/Channels/Guild/Common/TransientGuildChannel.cs @@ -63,7 +63,7 @@ protected TransientGuildChannel(IClient client, ChannelJsonModel model) return new TransientForumChannel(client, model); case ChannelType.Media: - return new TransientForumChannel(client, model); + return new TransientMediaChannel(client, model); } return new TransientUnknownGuildChannel(client, model); diff --git a/src/Disqord.Rest.Api/Content/Json/CreateForumThreadJsonRestRequestContent.cs b/src/Disqord.Rest.Api/Content/Json/CreateThreadPostJsonRestRequestContent.cs similarity index 81% rename from src/Disqord.Rest.Api/Content/Json/CreateForumThreadJsonRestRequestContent.cs rename to src/Disqord.Rest.Api/Content/Json/CreateThreadPostJsonRestRequestContent.cs index 7695279e3..ad1fbe257 100644 --- a/src/Disqord.Rest.Api/Content/Json/CreateForumThreadJsonRestRequestContent.cs +++ b/src/Disqord.Rest.Api/Content/Json/CreateThreadPostJsonRestRequestContent.cs @@ -5,7 +5,7 @@ namespace Disqord.Rest.Api; -public class CreateForumThreadJsonRestRequestContent : CreateThreadJsonRestRequestContent, IAttachmentRestRequestContent +public class CreateThreadPostJsonRestRequestContent : CreateThreadJsonRestRequestContent, IAttachmentRestRequestContent { [JsonProperty("message")] public CreateMessageJsonRestRequestContent Message = null!; diff --git a/src/Disqord.Rest.Api/Methods/RestApiClientExtensions.Channel.cs b/src/Disqord.Rest.Api/Methods/RestApiClientExtensions.Channel.cs index ead4c0fe3..89598d50b 100644 --- a/src/Disqord.Rest.Api/Methods/RestApiClientExtensions.Channel.cs +++ b/src/Disqord.Rest.Api/Methods/RestApiClientExtensions.Channel.cs @@ -278,19 +278,19 @@ public static Task CreateThreadAsync(this IRestApiClient clien return client.ExecuteAsync(route, content, options, cancellationToken); } - public static Task CreateForumThreadAsync(this IRestApiClient client, - Snowflake channelId, CreateForumThreadJsonRestRequestContent content, + public static Task CreateThreadPostAsync(this IRestApiClient client, + Snowflake channelId, CreateThreadPostJsonRestRequestContent content, IRestRequestOptions? options = null, CancellationToken cancellationToken = default) { - var route = Format(Route.Channel.StartForumThread, channelId); + var route = Format(Route.Channel.CreateThreadPost, channelId); return client.ExecuteAsync(route, content, options, cancellationToken); } - public static Task CreateForumThreadAsync(this IRestApiClient client, - Snowflake channelId, AttachmentJsonPayloadRestRequestContent content, + public static Task CreateThreadPostAsync(this IRestApiClient client, + Snowflake channelId, AttachmentJsonPayloadRestRequestContent content, IRestRequestOptions? options = null, CancellationToken cancellationToken = default) { - var route = Format(Route.Channel.StartForumThread, channelId); + var route = Format(Route.Channel.CreateThreadPost, channelId); return client.ExecuteAsync(route, content, options, cancellationToken); } diff --git a/src/Disqord.Rest.Api/Requests/Routing/Default/Route.Static.cs b/src/Disqord.Rest.Api/Requests/Routing/Default/Route.Static.cs index 81ba04d41..768259552 100644 --- a/src/Disqord.Rest.Api/Requests/Routing/Default/Route.Static.cs +++ b/src/Disqord.Rest.Api/Requests/Routing/Default/Route.Static.cs @@ -89,7 +89,7 @@ public static class Channel public static readonly Route StartThread = Post("channels/{0:channel_id}/threads"); - public static readonly Route StartForumThread = Post("channels/{0:channel_id}/threads"); + public static readonly Route CreateThreadPost = Post("channels/{0:channel_id}/threads"); public static readonly Route JoinThread = Put("channels/{0:channel_id}/thread-members/@me"); diff --git a/src/Disqord.Rest/Extensions/Entity/RestEntityExtensions.Channel.cs b/src/Disqord.Rest/Extensions/Entity/RestEntityExtensions.Channel.cs index dc2227c10..855193e7b 100644 --- a/src/Disqord.Rest/Extensions/Entity/RestEntityExtensions.Channel.cs +++ b/src/Disqord.Rest/Extensions/Entity/RestEntityExtensions.Channel.cs @@ -310,12 +310,12 @@ public static Task CreatePrivateThreadAsync(this ITextChannel ch return client.CreatePrivateThreadAsync(channel.Id, name, action, options, cancellationToken); } - public static Task CreateThreadAsync(this IForumChannel channel, + public static Task CreateThreadPostAsync(this IMediaChannel channel, string name, LocalMessage message, Action? action = null, IRestRequestOptions? options = null, CancellationToken cancellationToken = default) { var client = channel.GetRestClient(); - return client.CreateForumThreadAsync(channel.Id, name, message, action, options, cancellationToken); + return client.CreateThreadPostAsync(channel.Id, name, message, action, options, cancellationToken); } public static Task JoinAsync(this IThreadChannel thread, diff --git a/src/Disqord.Rest/Extensions/RestClientExtensions.Channel.cs b/src/Disqord.Rest/Extensions/RestClientExtensions.Channel.cs index 4afc61fba..3aea8b8e1 100644 --- a/src/Disqord.Rest/Extensions/RestClientExtensions.Channel.cs +++ b/src/Disqord.Rest/Extensions/RestClientExtensions.Channel.cs @@ -644,7 +644,7 @@ public static async Task CreatePrivateThreadAsync(this IRestClie return new TransientThreadChannel(client, model); } - public static async Task CreateForumThreadAsync(this IRestClient client, + public static async Task CreateThreadPostAsync(this IRestClient client, Snowflake channelId, string name, LocalMessage message, Action? action = null, IRestRequestOptions? options = null, CancellationToken cancellationToken = default) { @@ -668,7 +668,7 @@ public static async Task CreateForumThreadAsync(this IRestClient EnforceNonce = message.ShouldEnforceNonce }; - var forumContent = new CreateForumThreadJsonRestRequestContent + var postContent = new CreateThreadPostJsonRestRequestContent { Name = name, AutoArchiveDuration = Optional.Convert(properties.AutomaticArchiveDuration, x => (int) x.TotalMinutes), @@ -682,12 +682,12 @@ public static async Task CreateForumThreadAsync(this IRestClient { // If there are attachments, we must send them via multipart HTTP content. // Our `messageContent` will be serialized into a "payload_json" form data field. - var content = new AttachmentJsonPayloadRestRequestContent(forumContent, attachments); - task = client.ApiClient.CreateForumThreadAsync(channelId, content, options, cancellationToken); + var content = new AttachmentJsonPayloadRestRequestContent(postContent, attachments); + task = client.ApiClient.CreateThreadPostAsync(channelId, content, options, cancellationToken); } else { - task = client.ApiClient.CreateForumThreadAsync(channelId, forumContent, options, cancellationToken); + task = client.ApiClient.CreateThreadPostAsync(channelId, postContent, options, cancellationToken); } var model = await task.ConfigureAwait(false);