Finish SocketVoiceChannel.ConnectAsync
This commit is contained in:
@@ -45,8 +45,9 @@ namespace Discord
|
|||||||
await Discord.ApiClient.SendVoiceStateUpdateAsync(Guild.Id, Id,
|
await Discord.ApiClient.SendVoiceStateUpdateAsync(Guild.Id, Id,
|
||||||
(audioMode & AudioMode.Incoming) == 0,
|
(audioMode & AudioMode.Incoming) == 0,
|
||||||
(audioMode & AudioMode.Outgoing) == 0).ConfigureAwait(false);
|
(audioMode & AudioMode.Outgoing) == 0).ConfigureAwait(false);
|
||||||
return null;
|
|
||||||
//TODO: Block and return
|
await Guild.AudioPromise.ConfigureAwait(false);
|
||||||
|
return Guild.AudioClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SocketVoiceChannel Clone() => MemberwiseClone() as SocketVoiceChannel;
|
public SocketVoiceChannel Clone() => MemberwiseClone() as SocketVoiceChannel;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Discord
|
|||||||
internal override bool IsAttached => true;
|
internal override bool IsAttached => true;
|
||||||
|
|
||||||
private readonly SemaphoreSlim _audioLock;
|
private readonly SemaphoreSlim _audioLock;
|
||||||
private TaskCompletionSource<bool> _syncPromise, _downloaderPromise;
|
private TaskCompletionSource<bool> _syncPromise, _downloaderPromise, _audioPromise;
|
||||||
private ConcurrentHashSet<ulong> _channels;
|
private ConcurrentHashSet<ulong> _channels;
|
||||||
private ConcurrentDictionary<ulong, SocketGuildUser> _members;
|
private ConcurrentDictionary<ulong, SocketGuildUser> _members;
|
||||||
private ConcurrentDictionary<ulong, VoiceState> _voiceStates;
|
private ConcurrentDictionary<ulong, VoiceState> _voiceStates;
|
||||||
@@ -39,6 +39,7 @@ namespace Discord
|
|||||||
public bool IsSynced => _syncPromise.Task.IsCompleted;
|
public bool IsSynced => _syncPromise.Task.IsCompleted;
|
||||||
public Task SyncPromise => _syncPromise.Task;
|
public Task SyncPromise => _syncPromise.Task;
|
||||||
public Task DownloaderPromise => _downloaderPromise.Task;
|
public Task DownloaderPromise => _downloaderPromise.Task;
|
||||||
|
public Task AudioPromise => _audioPromise.Task;
|
||||||
|
|
||||||
public new DiscordSocketClient Discord => base.Discord as DiscordSocketClient;
|
public new DiscordSocketClient Discord => base.Discord as DiscordSocketClient;
|
||||||
public SocketGuildUser CurrentUser => GetUser(Discord.CurrentUser.Id);
|
public SocketGuildUser CurrentUser => GetUser(Discord.CurrentUser.Id);
|
||||||
@@ -307,6 +308,7 @@ namespace Discord
|
|||||||
_audioLock.Release();
|
_audioLock.Release();
|
||||||
}
|
}
|
||||||
await audioClient.ConnectAsync(url, CurrentUser.Id, voiceState.VoiceSessionId, token).ConfigureAwait(false);
|
await audioClient.ConnectAsync(url, CurrentUser.Id, voiceState.VoiceSessionId, token).ConfigureAwait(false);
|
||||||
|
_audioPromise.TrySetResult(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SocketGuild Clone() => MemberwiseClone() as SocketGuild;
|
public SocketGuild Clone() => MemberwiseClone() as SocketGuild;
|
||||||
|
|||||||
Reference in New Issue
Block a user