Browse Source

Return voice client from JoinVoiceServer

tags/docs-0.9
RogueException 9 years ago
parent
commit
3b13b561f0
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      src/Discord.Net/DiscordClient.cs

+ 4
- 3
src/Discord.Net/DiscordClient.cs View File

@@ -714,11 +714,11 @@ namespace Discord
return client; return client;
} }


public Task JoinVoiceServer(Channel channel)
public Task<IDiscordVoiceClient> JoinVoiceServer(Channel channel)
=> JoinVoiceServer(channel?.ServerId, channel?.Id); => JoinVoiceServer(channel?.ServerId, channel?.Id);
public Task JoinVoiceServer(Server server, string channelId)
public Task<IDiscordVoiceClient> JoinVoiceServer(Server server, string channelId)
=> JoinVoiceServer(server?.Id, channelId); => JoinVoiceServer(server?.Id, channelId);
public async Task JoinVoiceServer(string serverId, string channelId)
public async Task<IDiscordVoiceClient> JoinVoiceServer(string serverId, string channelId)
{ {
CheckReady(); //checkVoice is done inside the voice client CheckReady(); //checkVoice is done inside the voice client
if (serverId == null) throw new ArgumentNullException(nameof(serverId)); if (serverId == null) throw new ArgumentNullException(nameof(serverId));
@@ -726,6 +726,7 @@ namespace Discord


var client = await CreateVoiceClient(serverId).ConfigureAwait(false); var client = await CreateVoiceClient(serverId).ConfigureAwait(false);
await client.JoinChannel(channelId).ConfigureAwait(false); await client.JoinChannel(channelId).ConfigureAwait(false);
return client;
} }


async Task LeaveVoiceServer(string serverId) async Task LeaveVoiceServer(string serverId)


Loading…
Cancel
Save