Browse Source

Ephemeral attachments

pull/1923/head
quin lynch 3 years ago
parent
commit
266a9c89c9
3 changed files with 14 additions and 2 deletions
  1. +7
    -0
      src/Discord.Net.Core/Entities/Messages/IAttachment.cs
  2. +1
    -0
      src/Discord.Net.Rest/API/Common/Attachment.cs
  3. +6
    -2
      src/Discord.Net.Rest/Entities/Messages/Attachment.cs

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

@@ -55,5 +55,12 @@ namespace Discord
/// The width of this attachment if it is a picture; otherwise <c>null</c>.
/// </returns>
int? Width { get; }
/// <summary>
/// Gets whether or not this attachment is ephemeral.
/// </summary>
/// <returns>
/// <see langword="true"/> if the attachment is ephemeral; otherwise <see langword="false"/>.
/// </returns>
bool Ephemeral { get; }
}
}

+ 1
- 0
src/Discord.Net.Rest/API/Common/Attachment.cs View File

@@ -18,5 +18,6 @@ namespace Discord.API
public Optional<int> Height { get; set; }
[JsonProperty("width")]
public Optional<int> Width { get; set; }
public Optional<bool> Ephemeral { get; set; }
}
}

+ 6
- 2
src/Discord.Net.Rest/Entities/Messages/Attachment.cs View File

@@ -21,8 +21,10 @@ namespace Discord
public int? Height { get; }
/// <inheritdoc />
public int? Width { get; }
/// <inheritdoc />
public bool Ephemeral { get; }

internal Attachment(ulong id, string filename, string url, string proxyUrl, int size, int? height, int? width)
internal Attachment(ulong id, string filename, string url, string proxyUrl, int size, int? height, int? width, bool? ephemeral)
{
Id = id;
Filename = filename;
@@ -31,12 +33,14 @@ namespace Discord
Size = size;
Height = height;
Width = width;
Ephemeral = ephemeral.GetValueOrDefault(false);
}
internal static Attachment Create(Model model)
{
return new Attachment(model.Id, model.Filename, model.Url, model.ProxyUrl, model.Size,
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());
}

/// <summary>


Loading…
Cancel
Save