Browse Source

Added a few missing properties

tags/docs-0.9
Brandon Smith 9 years ago
parent
commit
91812304dd
3 changed files with 28 additions and 11 deletions
  1. +6
    -0
      src/Discord.Net/API/Models/Common.cs
  2. +4
    -1
      src/Discord.Net/DiscordClient.cs
  3. +18
    -10
      src/Discord.Net/Message.cs

+ 6
- 0
src/Discord.Net/API/Models/Common.cs View File

@@ -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")]


+ 4
- 1
src/Discord.Net/DiscordClient.cs View File

@@ -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;
}


+ 18
- 10
src/Discord.Net/Message.cs View File

@@ -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;
/// <summary> Unique identifier for this file. </summary>
public string Id { get; internal set; }
/// <summary> Download url for this file. </summary>
public string Url { get; internal set; }
/// <summary> Preview url for this file. </summary>
public string ProxyUrl { get; internal set; }
/// <summary> Width of the this file, if it is an image. </summary>
public int? Width { get; internal set; }
/// <summary> Height of this file, if it is an image. </summary>
public int? Height { get; internal set; }
/// <summary> Size, in bytes, of this file file. </summary>
public int Size { get; internal set; }
/// <summary> Filename of this file. </summary>
public string Filename { get; internal set; }
}

private readonly DiscordClient _client;
@@ -37,8 +43,10 @@ namespace Discord
/// <summary> Returns the content of this message with any special references such as mentions converted. </summary>
/// <remarks> This value is lazy loaded and only processed on first request. Each subsequent request will pull from cache. </remarks>
public string Text => _cleanText != null ? _cleanText : (_cleanText = _client.CleanMessageText(RawText));
/// <summary> Returns the timestamp of this message. </summary>
/// <summary> Returns the timestamp for when this message was sent. </summary>
public DateTime Timestamp { get; internal set; }
/// <summary> Returns the timestamp for when this message was last edited. </summary>
public DateTime? EditedTimestamp { get; internal set; }
/// <summary> Returns the attachments included in this message. </summary>
public Attachment[] Attachments { get; internal set; }



Loading…
Cancel
Save