Return voice client from JoinVoiceServer
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user