diff --git a/src/Discord.Net/API/Models/Common.cs b/src/Discord.Net/API/Models/Common.cs index 4ec6aae0a..af3398179 100644 --- a/src/Discord.Net/API/Models/Common.cs +++ b/src/Discord.Net/API/Models/Common.cs @@ -162,6 +162,10 @@ namespace Discord.API.Models public int Size; [JsonProperty(PropertyName = "filename")] public string Filename; + [JsonProperty(PropertyName = "width")] + public int Width; + [JsonProperty(PropertyName = "height")] + public int Height; } [JsonProperty(PropertyName = "tts")] @@ -170,6 +174,8 @@ namespace Discord.API.Models public bool IsMentioningEveryone; [JsonProperty(PropertyName = "timestamp")] public DateTime Timestamp; + [JsonProperty(PropertyName = "edited_timestamp")] + public DateTime? EditedTimestamp; [JsonProperty(PropertyName = "mentions")] public UserReference[] Mentions; [JsonProperty(PropertyName = "embeds")] diff --git a/src/Discord.Net/DiscordClient.cs b/src/Discord.Net/DiscordClient.cs index d314370b6..dc7d50205 100644 --- a/src/Discord.Net/DiscordClient.cs +++ b/src/Discord.Net/DiscordClient.cs @@ -164,7 +164,9 @@ namespace Discord Url = x.Url, ProxyUrl = x.ProxyUrl, Size = x.Size, - Filename = x.Filename + Filename = x.Filename, + Width = x.Width, + Height = x.Height }).ToArray(); } else @@ -176,6 +178,7 @@ namespace Discord message.IsMentioningMe = message.MentionIds.Contains(UserId); message.RawText = extendedModel.Content; message.Timestamp = extendedModel.Timestamp; + message.EditedTimestamp = extendedModel.EditedTimestamp; if (extendedModel.Author != null) message.UserId = extendedModel.Author.Id; } diff --git a/src/Discord.Net/Message.cs b/src/Discord.Net/Message.cs index 343e65612..827cdb36e 100644 --- a/src/Discord.Net/Message.cs +++ b/src/Discord.Net/Message.cs @@ -2,21 +2,27 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Text.RegularExpressions; namespace Discord { public sealed class Message { - - public struct Attachment + public class Attachment { - public string Id; - public string Url; - public string ProxyUrl; - public int Size; - public string Filename; + /// Unique identifier for this file. + public string Id { get; internal set; } + /// Download url for this file. + public string Url { get; internal set; } + /// Preview url for this file. + public string ProxyUrl { get; internal set; } + /// Width of the this file, if it is an image. + public int? Width { get; internal set; } + /// Height of this file, if it is an image. + public int? Height { get; internal set; } + /// Size, in bytes, of this file file. + public int Size { get; internal set; } + /// Filename of this file. + public string Filename { get; internal set; } } private readonly DiscordClient _client; @@ -37,8 +43,10 @@ namespace Discord /// Returns the content of this message with any special references such as mentions converted. /// This value is lazy loaded and only processed on first request. Each subsequent request will pull from cache. public string Text => _cleanText != null ? _cleanText : (_cleanText = _client.CleanMessageText(RawText)); - /// Returns the timestamp of this message. + /// Returns the timestamp for when this message was sent. public DateTime Timestamp { get; internal set; } + /// Returns the timestamp for when this message was last edited. + public DateTime? EditedTimestamp { get; internal set; } /// Returns the attachments included in this message. public Attachment[] Attachments { get; internal set; }