| @@ -7,13 +7,29 @@ using System.Threading.Tasks; | |||||
| namespace Discord | namespace Discord | ||||
| { | { | ||||
| /// <summary> | |||||
| /// Represents an outgoing file attachment used to send a file to discord. | |||||
| /// </summary> | |||||
| public struct FileAttachment : IDisposable | public struct FileAttachment : IDisposable | ||||
| { | { | ||||
| /// <summary> | |||||
| /// Gets or sets the filename. | |||||
| /// </summary> | |||||
| public string FileName { get; set; } | public string FileName { get; set; } | ||||
| /// <summary> | |||||
| /// Gets or sets the description of the file. | |||||
| /// </summary> | |||||
| public string Description { get; set; } | public string Description { get; set; } | ||||
| /// <summary> | |||||
| /// Gets or sets whether this file should be marked as a spoiler. | |||||
| /// </summary> | |||||
| public bool IsSpoiler { get; set; } | public bool IsSpoiler { get; set; } | ||||
| #pragma warning disable IDISP008 | #pragma warning disable IDISP008 | ||||
| /// <summary> | |||||
| /// Gets the stream containing the file content. | |||||
| /// </summary> | |||||
| public Stream Stream { get; } | public Stream Stream { get; } | ||||
| #pragma warning restore IDISP008 | #pragma warning restore IDISP008 | ||||
| @@ -62,5 +62,13 @@ namespace Discord | |||||
| /// <see langword="true"/> if the attachment is ephemeral; otherwise <see langword="false"/>. | /// <see langword="true"/> if the attachment is ephemeral; otherwise <see langword="false"/>. | ||||
| /// </returns> | /// </returns> | ||||
| bool Ephemeral { get; } | bool Ephemeral { get; } | ||||
| /// <summary> | |||||
| /// Gets the description of the attachment; or <see langword="null"/> if there is none set. | |||||
| /// </summary> | |||||
| string Description { get; } | |||||
| /// <summary> | |||||
| /// Gets the media's <see href="https://en.wikipedia.org/wiki/Media_type">MIME type</see> if present; otherwise <see langword="null"/>. | |||||
| /// </summary> | |||||
| string ContentType { get; } | |||||
| } | } | ||||
| } | } | ||||
| @@ -23,8 +23,13 @@ namespace Discord | |||||
| public int? Width { get; } | public int? Width { get; } | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public bool Ephemeral { get; } | public bool Ephemeral { get; } | ||||
| /// <inheritdoc /> | |||||
| public string Description { get; } | |||||
| /// <inheritdoc /> | |||||
| public string ContentType { get; } | |||||
| internal Attachment(ulong id, string filename, string url, string proxyUrl, int size, int? height, int? width, bool? ephemeral) | |||||
| internal Attachment(ulong id, string filename, string url, string proxyUrl, int size, int? height, int? width, | |||||
| bool? ephemeral, string description, string contentType) | |||||
| { | { | ||||
| Id = id; | Id = id; | ||||
| Filename = filename; | Filename = filename; | ||||
| @@ -34,13 +39,16 @@ namespace Discord | |||||
| Height = height; | Height = height; | ||||
| Width = width; | Width = width; | ||||
| Ephemeral = ephemeral.GetValueOrDefault(false); | Ephemeral = ephemeral.GetValueOrDefault(false); | ||||
| Description = description; | |||||
| ContentType = contentType; | |||||
| } | } | ||||
| internal static Attachment Create(Model model) | internal static Attachment Create(Model model) | ||||
| { | { | ||||
| return new Attachment(model.Id, model.Filename, model.Url, model.ProxyUrl, model.Size, | return new Attachment(model.Id, model.Filename, model.Url, model.ProxyUrl, model.Size, | ||||
| model.Height.IsSpecified ? model.Height.Value : (int?)null, | model.Height.IsSpecified ? model.Height.Value : (int?)null, | ||||
| model.Width.IsSpecified ? model.Width.Value : (int?)null, | model.Width.IsSpecified ? model.Width.Value : (int?)null, | ||||
| model.Ephemeral.ToNullable()); | |||||
| model.Ephemeral.ToNullable(), model.Description.GetValueOrDefault(), | |||||
| model.ContentType.GetValueOrDefault()); | |||||
| } | } | ||||
| /// <summary> | /// <summary> | ||||