@@ -89,6 +89,14 @@ namespace Discord | |||||
/// </summary> | /// </summary> | ||||
IUser Author { get; } | IUser Author { get; } | ||||
/// <summary> | |||||
/// Gets the thread that was started from this message. | |||||
/// </summary> | |||||
/// <returns> | |||||
/// An <see cref="IThreadChannel"/> object if this message has thread attached; otherwise <see langword="null"/>. | |||||
/// </returns> | |||||
IThreadChannel Thread { get; } | |||||
/// <summary> | /// <summary> | ||||
/// Gets all attachments included in this message. | /// Gets all attachments included in this message. | ||||
/// </summary> | /// </summary> | ||||
@@ -16,14 +16,6 @@ namespace Discord | |||||
/// </returns> | /// </returns> | ||||
IUserMessage ReferencedMessage { get; } | IUserMessage ReferencedMessage { get; } | ||||
/// <summary> | |||||
/// Gets the thread that was started from this message. | |||||
/// </summary> | |||||
/// <returns> | |||||
/// An <see cref="IThreadChannel"/> object if this message has thread attached; otherwise <see langword="null"/>. | |||||
/// </returns> | |||||
IThreadChannel Thread { get; } | |||||
/// <summary> | /// <summary> | ||||
/// Modifies this message. | /// Modifies this message. | ||||
/// </summary> | /// </summary> | ||||
@@ -1,9 +1,13 @@ | |||||
using Discord.API; | |||||
using Newtonsoft.Json.Linq; | using Newtonsoft.Json.Linq; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.Immutable; | using System.Collections.Immutable; | ||||
using System.Linq; | using System.Linq; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using Model = Discord.API.Message; | using Model = Discord.API.Message; | ||||
namespace Discord.Rest | namespace Discord.Rest | ||||
@@ -45,6 +49,12 @@ namespace Discord.Rest | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public virtual bool MentionedEveryone => false; | public virtual bool MentionedEveryone => false; | ||||
/// <inheritdoc cref="IMessage.Thread"/> | |||||
public RestThreadChannel Thread { get; private set; } | |||||
/// <inheritdoc /> | |||||
IThreadChannel IMessage.Thread => Thread; | |||||
/// <summary> | /// <summary> | ||||
/// Gets a collection of the <see cref="Attachment"/>'s on the message. | /// Gets a collection of the <see cref="Attachment"/>'s on the message. | ||||
/// </summary> | /// </summary> | ||||
@@ -255,6 +265,9 @@ namespace Discord.Rest | |||||
model.RoleSubscriptionData.Value.MonthsSubscribed, | model.RoleSubscriptionData.Value.MonthsSubscribed, | ||||
model.RoleSubscriptionData.Value.IsRenewal); | model.RoleSubscriptionData.Value.IsRenewal); | ||||
} | } | ||||
if (model.Thread.IsSpecified) | |||||
Thread = RestThreadChannel.Create(Discord, new RestGuild(Discord, model.Thread.Value.GuildId.Value), model.Thread.Value); | |||||
} | } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public async Task UpdateAsync(RequestOptions options = null) | public async Task UpdateAsync(RequestOptions options = null) | ||||
@@ -296,7 +309,7 @@ namespace Discord.Rest | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
IReadOnlyCollection<IStickerItem> IMessage.Stickers => Stickers; | IReadOnlyCollection<IStickerItem> IMessage.Stickers => Stickers; | ||||
#endregion | #endregion | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
@@ -47,12 +47,6 @@ namespace Discord.Rest | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public IUserMessage ReferencedMessage => _referencedMessage; | public IUserMessage ReferencedMessage => _referencedMessage; | ||||
/// <inheritdoc cref="IUserMessage.Thread"/> | |||||
public RestThreadChannel Thread { get; private set; } | |||||
/// <inheritdoc /> | |||||
IThreadChannel IUserMessage.Thread => Thread; | |||||
internal RestUserMessage(BaseDiscordClient discord, ulong id, IMessageChannel channel, IUser author, MessageSource source) | internal RestUserMessage(BaseDiscordClient discord, ulong id, IMessageChannel channel, IUser author, MessageSource source) | ||||
: base(discord, id, channel, author, source) | : base(discord, id, channel, author, source) | ||||
{ | { | ||||
@@ -136,9 +130,6 @@ namespace Discord.Rest | |||||
else | else | ||||
_stickers = ImmutableArray.Create<StickerItem>(); | _stickers = ImmutableArray.Create<StickerItem>(); | ||||
} | } | ||||
if(model.Thread.IsSpecified) | |||||
Thread = RestThreadChannel.Create(Discord, guild, model.Thread.Value); | |||||
} | } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
@@ -81,6 +81,12 @@ namespace Discord.WebSocket | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public MessageRoleSubscriptionData RoleSubscriptionData { get; private set; } | public MessageRoleSubscriptionData RoleSubscriptionData { get; private set; } | ||||
/// <inheritdoc cref="IMessage.Thread"/> | |||||
public SocketThreadChannel Thread { get; private set; } | |||||
/// <inheritdoc /> | |||||
IThreadChannel IMessage.Thread => Thread; | |||||
/// <summary> | /// <summary> | ||||
/// Returns all attachments included in this message. | /// Returns all attachments included in this message. | ||||
/// </summary> | /// </summary> | ||||
@@ -283,6 +289,12 @@ namespace Discord.WebSocket | |||||
model.RoleSubscriptionData.Value.MonthsSubscribed, | model.RoleSubscriptionData.Value.MonthsSubscribed, | ||||
model.RoleSubscriptionData.Value.IsRenewal); | model.RoleSubscriptionData.Value.IsRenewal); | ||||
} | } | ||||
if (model.Thread.IsSpecified) | |||||
{ | |||||
SocketGuild guild = (Channel as SocketGuildChannel)?.Guild; | |||||
Thread = guild?.AddOrUpdateChannel(state, model.Thread.Value) as SocketThreadChannel; | |||||
} | |||||
} | } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
@@ -49,12 +49,6 @@ namespace Discord.WebSocket | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public IUserMessage ReferencedMessage => _referencedMessage; | public IUserMessage ReferencedMessage => _referencedMessage; | ||||
/// <inheritdoc cref="IUserMessage.Thread"/> | |||||
public SocketThreadChannel Thread { get; private set; } | |||||
/// <inheritdoc /> | |||||
IThreadChannel IUserMessage.Thread => Thread; | |||||
internal SocketUserMessage(DiscordSocketClient discord, ulong id, ISocketMessageChannel channel, SocketUser author, MessageSource source) | internal SocketUserMessage(DiscordSocketClient discord, ulong id, ISocketMessageChannel channel, SocketUser author, MessageSource source) | ||||
: base(discord, id, channel, author, source) | : base(discord, id, channel, author, source) | ||||
{ | { | ||||
@@ -178,11 +172,6 @@ namespace Discord.WebSocket | |||||
else | else | ||||
_stickers = ImmutableArray.Create<SocketSticker>(); | _stickers = ImmutableArray.Create<SocketSticker>(); | ||||
} | } | ||||
if (model.Thread.IsSpecified) | |||||
{ | |||||
Thread = guild!.AddOrUpdateChannel(state, model.Thread.Value) as SocketThreadChannel; | |||||
} | |||||
} | } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||