diff --git a/src/Discord.Net/DiscordClient.API.cs b/src/Discord.Net/DiscordClient.API.cs
index 2dade8b2a..89a4a9d69 100644
--- a/src/Discord.Net/DiscordClient.API.cs
+++ b/src/Discord.Net/DiscordClient.API.cs
@@ -470,57 +470,6 @@ namespace Discord
return _api.Undeafen(serverId, userId);
}
-#if !DNXCORE50
- public Task JoinVoiceServer(string channelId)
- => JoinVoiceServer(_channels[channelId]);
- public async Task JoinVoiceServer(Channel channel)
- {
- CheckReady();
- if (!_config.EnableVoice) throw new InvalidOperationException("Voice is not enabled for this client.");
- if (channel == null) throw new ArgumentNullException(nameof(channel));
-
- await LeaveVoiceServer();
- _currentVoiceServerId = channel.ServerId;
- _webSocket.JoinVoice(channel);
- }
-
- public async Task LeaveVoiceServer()
- {
- if (!_config.EnableVoice) throw new InvalidOperationException("Voice is not enabled for this client.");
-
- await _voiceWebSocket.DisconnectAsync();
- if (_currentVoiceServerId != null)
- _webSocket.LeaveVoice();
- _currentVoiceServerId = null;
- _currentVoiceToken = null;
- }
-
- /// Sends a PCM frame to the voice server.
- /// PCM frame to send.
- /// Number of bytes in this frame.
- public void SendVoicePCM(byte[] data, int count)
- {
- CheckReady();
- if (!_config.EnableVoice) throw new InvalidOperationException("Voice is not enabled for this client.");
- if (count == 0) return;
-
- if (_isDebugMode)
- RaiseOnDebugMessage(DebugMessageType.VoiceOutput, $"Queued {count} bytes for voice output.");
- _voiceWebSocket.SendPCMFrame(data, count);
- }
-
- /// Clears the PCM buffer.
- public void ClearVoicePCM()
- {
- CheckReady();
- if (!_config.EnableVoice) throw new InvalidOperationException("Voice is not enabled for this client.");
-
- if (_isDebugMode)
- RaiseOnDebugMessage(DebugMessageType.VoiceOutput, $"Cleared the voice buffer.");
- _voiceWebSocket.ClearPCMFrames();
- }
-#endif
-
//Profile
/// Changes your username to newName.
public async Task ChangeUsername(string newName, string currentEmail, string currentPassword)
diff --git a/src/Discord.Net/DiscordClient.cs b/src/Discord.Net/DiscordClient.cs
index d14767f9a..44b4cd2d6 100644
--- a/src/Discord.Net/DiscordClient.cs
+++ b/src/Discord.Net/DiscordClient.cs
@@ -616,6 +616,58 @@ namespace Discord
}
}
+ //Voice
+#if !DNXCORE50
+ public Task JoinVoiceServer(string channelId)
+ => JoinVoiceServer(_channels[channelId]);
+ public async Task JoinVoiceServer(Channel channel)
+ {
+ CheckReady();
+ if (!_config.EnableVoice) throw new InvalidOperationException("Voice is not enabled for this client.");
+ if (channel == null) throw new ArgumentNullException(nameof(channel));
+
+ await LeaveVoiceServer();
+ _currentVoiceServerId = channel.ServerId;
+ _webSocket.JoinVoice(channel);
+ }
+
+ public async Task LeaveVoiceServer()
+ {
+ if (!_config.EnableVoice) throw new InvalidOperationException("Voice is not enabled for this client.");
+
+ await _voiceWebSocket.DisconnectAsync();
+ if (_currentVoiceServerId != null)
+ _webSocket.LeaveVoice();
+ _currentVoiceServerId = null;
+ _currentVoiceToken = null;
+ }
+
+ /// Sends a PCM frame to the voice server.
+ /// PCM frame to send.
+ /// Number of bytes in this frame.
+ public void SendVoicePCM(byte[] data, int count)
+ {
+ CheckReady();
+ if (!_config.EnableVoice) throw new InvalidOperationException("Voice is not enabled for this client.");
+ if (count == 0) return;
+
+ if (_isDebugMode)
+ RaiseOnDebugMessage(DebugMessageType.VoiceOutput, $"Queued {count} bytes for voice output.");
+ _voiceWebSocket.SendPCMFrame(data, count);
+ }
+
+ /// Clears the PCM buffer.
+ public void ClearVoicePCM()
+ {
+ CheckReady();
+ if (!_config.EnableVoice) throw new InvalidOperationException("Voice is not enabled for this client.");
+
+ if (_isDebugMode)
+ RaiseOnDebugMessage(DebugMessageType.VoiceOutput, $"Cleared the voice buffer.");
+ _voiceWebSocket.ClearPCMFrames();
+ }
+#endif
+
//Helpers
private void CheckReady()
{