Browse Source

Added IAttachment and several missing properties.

tags/1.0-rc
RogueException 9 years ago
parent
commit
2dea7ff7a9
6 changed files with 36 additions and 8 deletions
  1. +2
    -2
      src/Discord.Net/API/Common/EmbedThumbnail.cs
  2. +11
    -3
      src/Discord.Net/Entities/Messages/Attachment.cs
  3. +7
    -1
      src/Discord.Net/Entities/Messages/EmbedThumbnail.cs
  4. +14
    -0
      src/Discord.Net/Entities/Messages/IAttachment.cs
  5. +1
    -1
      src/Discord.Net/Entities/Messages/IMessage.cs
  6. +1
    -1
      src/Discord.Net/Entities/Messages/Message.cs

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

@@ -9,8 +9,8 @@ namespace Discord.API
[JsonProperty("proxy_url")]
public string ProxyUrl { get; set; }
[JsonProperty("height")]
public int Height { get; set; }
public Optional<int> Height { get; set; }
[JsonProperty("width")]
public int Width { get; set; }
public Optional<int> Width { get; set; }
}
}

+ 11
- 3
src/Discord.Net/Entities/Messages/Attachment.cs View File

@@ -2,17 +2,25 @@

namespace Discord
{
public struct Attachment
internal class Attachment : IAttachment
{
public ulong Id { get; }
public int Size { get; }
public string Filename { get; }
public string Url { get; }
public string ProxyUrl { get; }
public int Size { get; }
public int? Height { get; }
public int? Width { get; }

public Attachment(Model model)
{
Id = model.Id;
Size = model.Size;
Filename = model.Filename;
Size = model.Size;
Url = model.Url;
ProxyUrl = model.ProxyUrl;
Height = model.Height.IsSpecified ? model.Height.Value : (int?)null;
Width = model.Width.IsSpecified ? model.Width.Value : (int?)null;
}
}
}

+ 7
- 1
src/Discord.Net/Entities/Messages/EmbedThumbnail.cs View File

@@ -18,6 +18,12 @@ namespace Discord
}

internal EmbedThumbnail(Model model)
: this(model.Url, model.ProxyUrl, model.Height, model.Width) { }
: this(
model.Url,
model.ProxyUrl,
model.Height.IsSpecified ? model.Height.Value : (int?)null,
model.Width.IsSpecified ? model.Width.Value : (int?)null)
{
}
}
}

+ 14
- 0
src/Discord.Net/Entities/Messages/IAttachment.cs View File

@@ -0,0 +1,14 @@
namespace Discord
{
public interface IAttachment
{
ulong Id { get; }

string Filename { get; }
string Url { get; }
string ProxyUrl { get; }
int Size { get; }
int? Height { get; }
int? Width { get; }
}
}

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

@@ -25,7 +25,7 @@ namespace Discord
/// <summary> Gets the author of this message. </summary>
IUser Author { get; }
/// <summary> Returns a collection of all attachments included in this message. </summary>
IReadOnlyCollection<Attachment> Attachments { get; }
IReadOnlyCollection<IAttachment> Attachments { get; }
/// <summary> Returns a collection of all embeds included in this message. </summary>
IReadOnlyCollection<IEmbed> Embeds { get; }
/// <summary> Returns a collection of channel ids mentioned in this message. </summary>


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

@@ -23,7 +23,7 @@ namespace Discord
public IMessageChannel Channel { get; }
public IUser Author { get; }
public IReadOnlyCollection<Attachment> Attachments { get; private set; }
public IReadOnlyCollection<IAttachment> Attachments { get; private set; }
public IReadOnlyCollection<IEmbed> Embeds { get; private set; }
public IReadOnlyCollection<ulong> MentionedChannelIds { get; private set; }
public IReadOnlyCollection<IRole> MentionedRoles { get; private set; }


Loading…
Cancel
Save