-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add voice messages (discord/discord-api-docs#6082)
- Loading branch information
Showing
6 changed files
with
57 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using NetCord.JsonModels; | ||
|
||
namespace NetCord; | ||
|
||
public class VoiceAttachment : Attachment | ||
{ | ||
public VoiceAttachment(JsonAttachment jsonModel) : base(jsonModel) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// The duration of the audio file. | ||
/// </summary> | ||
public TimeSpan Duration => TimeSpan.FromSeconds(_jsonModel.DurationSeconds.GetValueOrDefault()); | ||
|
||
/// <summary> | ||
/// Byte array representing a sampled waveform. It is intended to be a preview of the entire voice message. Clients sample the recording at most once per 100 milliseconds, but will downsample so that no more than 256 datapoints are in the waveform. | ||
/// </summary> | ||
public byte[] Waveform => Convert.FromBase64String(_jsonModel.Waveform!); | ||
} |