[Feature] Rework Thread property of a message (#2579)
* move `Thread` property to `IUserMessage` & add one to `SocketUserMessage` * get channel from cache instead of creating new object * move the property back to IMessage
This commit is contained in:
@@ -81,6 +81,12 @@ namespace Discord.WebSocket
|
||||
/// <inheritdoc />
|
||||
public MessageRoleSubscriptionData RoleSubscriptionData { get; private set; }
|
||||
|
||||
/// <inheritdoc cref="IMessage.Thread"/>
|
||||
public SocketThreadChannel Thread { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
IThreadChannel IMessage.Thread => Thread;
|
||||
|
||||
/// <summary>
|
||||
/// Returns all attachments included in this message.
|
||||
/// </summary>
|
||||
@@ -283,6 +289,12 @@ namespace Discord.WebSocket
|
||||
model.RoleSubscriptionData.Value.MonthsSubscribed,
|
||||
model.RoleSubscriptionData.Value.IsRenewal);
|
||||
}
|
||||
|
||||
if (model.Thread.IsSpecified)
|
||||
{
|
||||
SocketGuild guild = (Channel as SocketGuildChannel)?.Guild;
|
||||
Thread = guild?.AddOrUpdateChannel(state, model.Thread.Value) as SocketThreadChannel;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user