Exposed IAudioClient.SetSpeakingAsync

This commit is contained in:
RogueException
2017-04-10 18:00:42 -03:00
parent d2a7be91e5
commit 8d9e11c08a
3 changed files with 16 additions and 11 deletions

View File

@@ -44,6 +44,7 @@ namespace Discord.Audio
private string _url, _sessionId, _token;
private ulong _userId;
private uint _ssrc;
private bool _isSpeaking;
public SocketGuild Guild { get; }
public DiscordVoiceAPIClient ApiClient { get; private set; }
@@ -242,6 +243,7 @@ namespace Discord.Audio
throw new InvalidOperationException($"Discord selected an unexpected mode: {data.Mode}");
SecretKey = data.SecretKey;
_isSpeaking = false;
await ApiClient.SendSetSpeaking(false).ConfigureAwait(false);
_keepaliveTask = RunKeepaliveAsync(5000, _connection.CancelToken);
@@ -453,6 +455,15 @@ namespace Discord.Audio
}
}
public async Task SetSpeakingAsync(bool value)
{
if (_isSpeaking != value)
{
_isSpeaking = value;
await ApiClient.SendSetSpeaking(value).ConfigureAwait(false);
}
}
internal void Dispose(bool disposing)
{
if (disposing)