Browse Source

fix: Message type (#1876)

* Fix message type

* Remove type from system entity
tags/3.0.0
Paulo GitHub 3 years ago
parent
commit
ac52a11d89
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 8 deletions
  1. +1
    -1
      src/Discord.Net.Core/Entities/Messages/IMessage.cs
  2. +5
    -2
      src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs
  3. +0
    -5
      src/Discord.Net.WebSocket/Entities/Messages/SocketSystemMessage.cs

+ 1
- 1
src/Discord.Net.Core/Entities/Messages/IMessage.cs 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>


+ 5
- 2
src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs 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;


+ 0
- 5
src/Discord.Net.WebSocket/Entities/Messages/SocketSystemMessage.cs 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})";


Loading…
Cancel
Save