[Feature] Voice messages support (#2665)

This commit is contained in:
Misha133
2023-04-15 02:04:41 +03:00
committed by GitHub
parent fe9657a0ee
commit f171684af1
11 changed files with 76 additions and 18 deletions

View File

@@ -24,5 +24,9 @@ namespace Discord.API
public Optional<int> Width { get; set; }
[JsonProperty("ephemeral")]
public Optional<bool> Ephemeral { get; set; }
[JsonProperty("duration_secs")]
public Optional<double> DurationSeconds { get; set; }
[JsonProperty("waveform")]
public Optional<string> Waveform { get; set; }
}
}

View File

@@ -27,9 +27,13 @@ namespace Discord
public string Description { get; }
/// <inheritdoc />
public string ContentType { get; }
/// <inheritdoc />
public string Waveform { get; }
/// <inheritdoc />
public double? Duration { get; }
internal Attachment(ulong id, string filename, string url, string proxyUrl, int size, int? height, int? width,
bool? ephemeral, string description, string contentType)
bool? ephemeral, string description, string contentType, double? duration, string waveform)
{
Id = id;
Filename = filename;
@@ -41,6 +45,8 @@ namespace Discord
Ephemeral = ephemeral.GetValueOrDefault(false);
Description = description;
ContentType = contentType;
Duration = duration;
Waveform = waveform;
}
internal static Attachment Create(Model model)
{
@@ -48,7 +54,9 @@ namespace Discord
model.Height.IsSpecified ? model.Height.Value : (int?)null,
model.Width.IsSpecified ? model.Width.Value : (int?)null,
model.Ephemeral.ToNullable(), model.Description.GetValueOrDefault(),
model.ContentType.GetValueOrDefault());
model.ContentType.GetValueOrDefault(),
model.DurationSeconds.IsSpecified ? model.DurationSeconds.Value : null,
model.Waveform.GetValueOrDefault(null));
}
/// <summary>