Remove more undeeded JoinVoiceServer parameters

This commit is contained in:
Brandon Smith
2015-09-03 20:32:04 -03:00
parent ccbdf8f63c
commit 94ec2ab5ca
2 changed files with 9 additions and 12 deletions

View File

@@ -471,20 +471,17 @@ namespace Discord
} }
#if !DNXCORE50 #if !DNXCORE50
public Task JoinVoiceServer(Channel channel) public Task JoinVoiceServer(string channelId)
=> JoinVoiceServer(channel?.ServerId, channel?.Id); => JoinVoiceServer(_channels[channelId]);
public Task JoinVoiceServer(Server server, string channelId) public async Task JoinVoiceServer(Channel channel)
=> JoinVoiceServer(server?.Id, channelId);
public async Task JoinVoiceServer(string serverId, string channelId)
{ {
CheckReady(); CheckReady();
if (!_config.EnableVoice) throw new InvalidOperationException("Voice is not enabled for this client."); if (!_config.EnableVoice) throw new InvalidOperationException("Voice is not enabled for this client.");
if (serverId == null) throw new ArgumentNullException(nameof(serverId)); if (channel == null) throw new ArgumentNullException(nameof(channel));
if (channelId == null) throw new ArgumentNullException(nameof(channelId));
await LeaveVoiceServer(); await LeaveVoiceServer();
_currentVoiceServerId = serverId; _currentVoiceServerId = channel.ServerId;
_webSocket.JoinVoice(serverId, channelId); _webSocket.JoinVoice(channel);
} }
public async Task LeaveVoiceServer() public async Task LeaveVoiceServer()

View File

@@ -90,11 +90,11 @@ namespace Discord
return new TextWebSocketCommands.KeepAlive(); return new TextWebSocketCommands.KeepAlive();
} }
public void JoinVoice(string serverId, string channelId) public void JoinVoice(Channel channel)
{ {
var joinVoice = new TextWebSocketCommands.JoinVoice(); var joinVoice = new TextWebSocketCommands.JoinVoice();
joinVoice.Payload.ServerId = serverId; joinVoice.Payload.ServerId = channel.ServerId;
joinVoice.Payload.ChannelId = channelId; joinVoice.Payload.ChannelId = channel.Id;
QueueMessage(joinVoice); QueueMessage(joinVoice);
} }
public void LeaveVoice() public void LeaveVoice()