Browse Source

Remove more undeeded JoinVoiceServer parameters

tags/docs-0.9
Brandon Smith 9 years ago
parent
commit
94ec2ab5ca
2 changed files with 9 additions and 12 deletions
  1. +6
    -9
      src/Discord.Net/DiscordClient.API.cs
  2. +3
    -3
      src/Discord.Net/DiscordDataSocket.cs

+ 6
- 9
src/Discord.Net/DiscordClient.API.cs View File

@@ -471,20 +471,17 @@ namespace Discord
}

#if !DNXCORE50
public Task JoinVoiceServer(Channel channel)
=> JoinVoiceServer(channel?.ServerId, channel?.Id);
public Task JoinVoiceServer(Server server, string channelId)
=> JoinVoiceServer(server?.Id, channelId);
public async Task JoinVoiceServer(string serverId, string channelId)
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 (serverId == null) throw new ArgumentNullException(nameof(serverId));
if (channelId == null) throw new ArgumentNullException(nameof(channelId));
if (channel == null) throw new ArgumentNullException(nameof(channel));

await LeaveVoiceServer();
_currentVoiceServerId = serverId;
_webSocket.JoinVoice(serverId, channelId);
_currentVoiceServerId = channel.ServerId;
_webSocket.JoinVoice(channel);
}

public async Task LeaveVoiceServer()


+ 3
- 3
src/Discord.Net/DiscordDataSocket.cs View File

@@ -90,11 +90,11 @@ namespace Discord
return new TextWebSocketCommands.KeepAlive();
}

public void JoinVoice(string serverId, string channelId)
public void JoinVoice(Channel channel)
{
var joinVoice = new TextWebSocketCommands.JoinVoice();
joinVoice.Payload.ServerId = serverId;
joinVoice.Payload.ChannelId = channelId;
joinVoice.Payload.ServerId = channel.ServerId;
joinVoice.Payload.ChannelId = channel.Id;
QueueMessage(joinVoice);
}
public void LeaveVoice()


Loading…
Cancel
Save