diff --git a/src/Discord.Net.Rest/API/Common/Message.cs b/src/Discord.Net.Rest/API/Common/Message.cs index f42a23b65..2b845bee1 100644 --- a/src/Discord.Net.Rest/API/Common/Message.cs +++ b/src/Discord.Net.Rest/API/Common/Message.cs @@ -64,5 +64,8 @@ namespace Discord.API public Optional StickerItems { get; set; } [JsonProperty("role_subscription_data")] public Optional RoleSubscriptionData { get; set; } + + [JsonProperty("thread")] + public Optional Thread { get; set; } } } diff --git a/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs b/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs index dfc814678..a497289d1 100644 --- a/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs +++ b/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs @@ -80,10 +80,19 @@ namespace Discord.Rest /// public MessageType Type { get; private set; } + + /// + /// Gets the thread that was started from this message. + /// + /// + /// A object if this message has thread attached; otherwise . + /// + public RestThreadChannel Thread { get; private set; } + /// public MessageRoleSubscriptionData RoleSubscriptionData { get; private set; } - /// + /// public IReadOnlyCollection Components { get; private set; } /// /// Gets a collection of the mentioned users in the message. @@ -255,6 +264,11 @@ namespace Discord.Rest model.RoleSubscriptionData.Value.MonthsSubscribed, model.RoleSubscriptionData.Value.IsRenewal); } + + if (model.Thread.IsSpecified) + { + Thread = RestThreadChannel.Create(Discord, new RestGuild(Discord, model.Thread.Value.GuildId.Value), model.Thread.Value); + } } /// public async Task UpdateAsync(RequestOptions options = null) @@ -274,11 +288,17 @@ namespace Discord.Rest /// public override string ToString() => Content; + #region IMessage + + /// IUser IMessage.Author => Author; + /// IReadOnlyCollection IMessage.Attachments => Attachments; + /// IReadOnlyCollection IMessage.Embeds => Embeds; + /// IReadOnlyCollection IMessage.MentionedUserIds => MentionedUsers.Select(x => x.Id).ToImmutableArray(); @@ -290,6 +310,8 @@ namespace Discord.Rest /// IReadOnlyCollection IMessage.Stickers => Stickers; + + #endregion /// public IReadOnlyDictionary Reactions => _reactions.ToDictionary(x => x.Emote, x => new ReactionMetadata { ReactionCount = x.Count, IsMe = x.Me });