fix: Message type (#1876)

* Fix message type

* Remove type from system entity
This commit is contained in:
Paulo
2021-06-17 20:17:03 -03:00
committed by GitHub
parent 7cf84995b2
commit ac52a11d89
3 changed files with 6 additions and 8 deletions

View File

@@ -10,7 +10,7 @@ namespace Discord
public interface IMessage : ISnowflakeEntity, IDeletable
{
/// <summary>
/// Gets the type of this system message.
/// Gets the type of this message.
/// </summary>
MessageType Type { get; }
/// <summary>

View File

@@ -61,6 +61,9 @@ namespace Discord.WebSocket
/// <inheritdoc />
public MessageFlags? Flags { get; private set; }
/// <inheritdoc/>
public MessageType Type { get; private set; }
/// <summary>
/// Returns all attachments included in this message.
/// </summary>
@@ -122,6 +125,8 @@ namespace Discord.WebSocket
}
internal virtual void Update(ClientState state, Model model)
{
Type = model.Type;
if (model.Timestamp.IsSpecified)
_timestampTicks = model.Timestamp.Value.UtcTicks;
@@ -185,8 +190,6 @@ namespace Discord.WebSocket
/// <inheritdoc />
IMessageChannel IMessage.Channel => Channel;
/// <inheritdoc />
MessageType IMessage.Type => MessageType.Default;
/// <inheritdoc />
IReadOnlyCollection<IAttachment> IMessage.Attachments => Attachments;
/// <inheritdoc />
IReadOnlyCollection<IEmbed> IMessage.Embeds => Embeds;

View File

@@ -9,9 +9,6 @@ namespace Discord.WebSocket
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class SocketSystemMessage : SocketMessage, ISystemMessage
{
/// <inheritdoc />
public MessageType Type { get; private set; }
internal SocketSystemMessage(DiscordSocketClient discord, ulong id, ISocketMessageChannel channel, SocketUser author)
: base(discord, id, channel, author, MessageSource.System)
{
@@ -25,8 +22,6 @@ namespace Discord.WebSocket
internal override void Update(ClientState state, Model model)
{
base.Update(state, model);
Type = model.Type;
}
private string DebuggerDisplay => $"{Author}: {Content} ({Id}, {Type})";