Browse Source

Add Type property to Messages

Complies with the new MessageType property on API v6
pull/124/head
Christopher F 9 years ago
parent
commit
40027878b5
4 changed files with 22 additions and 0 deletions
  1. +2
    -0
      src/Discord.Net/API/Common/Message.cs
  2. +2
    -0
      src/Discord.Net/Entities/Messages/IMessage.cs
  3. +1
    -0
      src/Discord.Net/Entities/Messages/Message.cs
  4. +17
    -0
      src/Discord.Net/Entities/Messages/MessageType.cs

+ 2
- 0
src/Discord.Net/API/Common/Message.cs View File

@@ -9,6 +9,8 @@ namespace Discord.API
public ulong Id { get; set; } public ulong Id { get; set; }
[JsonProperty("channel_id")] [JsonProperty("channel_id")]
public ulong ChannelId { get; set; } public ulong ChannelId { get; set; }
[JsonProperty("type")]
public MessageType Type { get; set; }
[JsonProperty("author")] [JsonProperty("author")]
public Optional<User> Author { get; set; } public Optional<User> Author { get; set; }
[JsonProperty("content")] [JsonProperty("content")]


+ 2
- 0
src/Discord.Net/Entities/Messages/IMessage.cs View File

@@ -17,6 +17,8 @@ namespace Discord
string Text { get; } string Text { get; }
/// <summary> Gets the time this message was sent. </summary> /// <summary> Gets the time this message was sent. </summary>
DateTimeOffset Timestamp { get; } DateTimeOffset Timestamp { get; }
/// <summary> Gets the type of message this is. Value will always be default, unless the message was sent in a group. </summary>
MessageType Type { get; }


/// <summary> Gets the channel this message was sent to. </summary> /// <summary> Gets the channel this message was sent to. </summary>
IMessageChannel Channel { get; } IMessageChannel Channel { get; }


+ 1
- 0
src/Discord.Net/Entities/Messages/Message.cs View File

@@ -18,6 +18,7 @@ namespace Discord
public bool IsTTS { get; private set; } public bool IsTTS { get; private set; }
public string Text { get; private set; } public string Text { get; private set; }
public bool IsPinned { get; private set; } public bool IsPinned { get; private set; }
public MessageType Type { get; private set; }
public IMessageChannel Channel { get; } public IMessageChannel Channel { get; }
public IUser Author { get; } public IUser Author { get; }


+ 17
- 0
src/Discord.Net/Entities/Messages/MessageType.cs View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Discord
{
public enum MessageType
{
Default = 0,
RecipientAdd = 1,
RecipientRemove = 2,
Call = 3,
NameChange = 4,
IconChange = 5
}
}

Loading…
Cancel
Save