fix: Message type (#1876)
* Fix message type * Remove type from system entity
This commit is contained in:
@@ -10,7 +10,7 @@ namespace Discord
|
|||||||
public interface IMessage : ISnowflakeEntity, IDeletable
|
public interface IMessage : ISnowflakeEntity, IDeletable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the type of this system message.
|
/// Gets the type of this message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MessageType Type { get; }
|
MessageType Type { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ namespace Discord.WebSocket
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public MessageFlags? Flags { get; private set; }
|
public MessageFlags? Flags { get; private set; }
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public MessageType Type { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns all attachments included in this message.
|
/// Returns all attachments included in this message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -122,6 +125,8 @@ namespace Discord.WebSocket
|
|||||||
}
|
}
|
||||||
internal virtual void Update(ClientState state, Model model)
|
internal virtual void Update(ClientState state, Model model)
|
||||||
{
|
{
|
||||||
|
Type = model.Type;
|
||||||
|
|
||||||
if (model.Timestamp.IsSpecified)
|
if (model.Timestamp.IsSpecified)
|
||||||
_timestampTicks = model.Timestamp.Value.UtcTicks;
|
_timestampTicks = model.Timestamp.Value.UtcTicks;
|
||||||
|
|
||||||
@@ -185,8 +190,6 @@ namespace Discord.WebSocket
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
IMessageChannel IMessage.Channel => Channel;
|
IMessageChannel IMessage.Channel => Channel;
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
MessageType IMessage.Type => MessageType.Default;
|
|
||||||
/// <inheritdoc />
|
|
||||||
IReadOnlyCollection<IAttachment> IMessage.Attachments => Attachments;
|
IReadOnlyCollection<IAttachment> IMessage.Attachments => Attachments;
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
IReadOnlyCollection<IEmbed> IMessage.Embeds => Embeds;
|
IReadOnlyCollection<IEmbed> IMessage.Embeds => Embeds;
|
||||||
|
|||||||
@@ -9,9 +9,6 @@ namespace Discord.WebSocket
|
|||||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
|
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
|
||||||
public class SocketSystemMessage : SocketMessage, ISystemMessage
|
public class SocketSystemMessage : SocketMessage, ISystemMessage
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
|
||||||
public MessageType Type { get; private set; }
|
|
||||||
|
|
||||||
internal SocketSystemMessage(DiscordSocketClient discord, ulong id, ISocketMessageChannel channel, SocketUser author)
|
internal SocketSystemMessage(DiscordSocketClient discord, ulong id, ISocketMessageChannel channel, SocketUser author)
|
||||||
: base(discord, id, channel, author, MessageSource.System)
|
: base(discord, id, channel, author, MessageSource.System)
|
||||||
{
|
{
|
||||||
@@ -25,8 +22,6 @@ namespace Discord.WebSocket
|
|||||||
internal override void Update(ClientState state, Model model)
|
internal override void Update(ClientState state, Model model)
|
||||||
{
|
{
|
||||||
base.Update(state, model);
|
base.Update(state, model);
|
||||||
|
|
||||||
Type = model.Type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string DebuggerDisplay => $"{Author}: {Content} ({Id}, {Type})";
|
private string DebuggerDisplay => $"{Author}: {Content} ({Id}, {Type})";
|
||||||
|
|||||||
Reference in New Issue
Block a user