- Remove ConfigAction from parameters - Add SelfDeafen/SelfMute to parameterspull/1057/head
| @@ -7,7 +7,7 @@ namespace Discord | |||||
| public interface IAudioChannel : IChannel | public interface IAudioChannel : IChannel | ||||
| { | { | ||||
| /// <summary> Connects to this audio channel. </summary> | /// <summary> Connects to this audio channel. </summary> | ||||
| Task<IAudioClient> ConnectAsync(Action<IAudioClient> configAction = null, bool external = false); | |||||
| Task<IAudioClient> ConnectAsync(bool selfDeaf = false, bool selfMute = false, bool external = false); | |||||
| /// <summary> Disconnects from this audio channel. </summary> | /// <summary> Disconnects from this audio channel. </summary> | ||||
| Task DisconnectAsync(); | Task DisconnectAsync(); | ||||
| @@ -143,7 +143,7 @@ namespace Discord.Rest | |||||
| => EnterTypingState(options); | => EnterTypingState(options); | ||||
| //IAudioChannel | //IAudioChannel | ||||
| Task<IAudioClient> IAudioChannel.ConnectAsync(Action<IAudioClient> configAction, bool external) { throw new NotSupportedException(); } | |||||
| Task<IAudioClient> IAudioChannel.ConnectAsync(bool selfDeaf, bool selfMute, bool external) { throw new NotSupportedException(); } | |||||
| Task IAudioChannel.DisconnectAsync() { throw new NotSupportedException(); } | Task IAudioChannel.DisconnectAsync() { throw new NotSupportedException(); } | ||||
| //IChannel | //IChannel | ||||
| @@ -41,7 +41,7 @@ namespace Discord.Rest | |||||
| private string DebuggerDisplay => $"{Name} ({Id}, Voice)"; | private string DebuggerDisplay => $"{Name} ({Id}, Voice)"; | ||||
| //IAudioChannel | //IAudioChannel | ||||
| Task<IAudioClient> IAudioChannel.ConnectAsync(Action<IAudioClient> configAction, bool external) { throw new NotSupportedException(); } | |||||
| Task<IAudioClient> IAudioChannel.ConnectAsync(bool selfDeaf, bool selfMute, bool external) { throw new NotSupportedException(); } | |||||
| Task IAudioChannel.DisconnectAsync() { throw new NotSupportedException(); } | Task IAudioChannel.DisconnectAsync() { throw new NotSupportedException(); } | ||||
| //IGuildChannel | //IGuildChannel | ||||
| @@ -206,7 +206,7 @@ namespace Discord.WebSocket | |||||
| => EnterTypingState(options); | => EnterTypingState(options); | ||||
| //IAudioChannel | //IAudioChannel | ||||
| Task<IAudioClient> IAudioChannel.ConnectAsync(Action<IAudioClient> configAction, bool external) { throw new NotSupportedException(); } | |||||
| Task<IAudioClient> IAudioChannel.ConnectAsync(bool selfDeaf, bool selfMute, bool external) { throw new NotSupportedException(); } | |||||
| Task IAudioChannel.DisconnectAsync() { throw new NotSupportedException(); } | Task IAudioChannel.DisconnectAsync() { throw new NotSupportedException(); } | ||||
| //IChannel | //IChannel | ||||
| @@ -40,9 +40,9 @@ namespace Discord.WebSocket | |||||
| public Task ModifyAsync(Action<VoiceChannelProperties> func, RequestOptions options = null) | public Task ModifyAsync(Action<VoiceChannelProperties> func, RequestOptions options = null) | ||||
| => ChannelHelper.ModifyAsync(this, Discord, func, options); | => ChannelHelper.ModifyAsync(this, Discord, func, options); | ||||
| public async Task<IAudioClient> ConnectAsync(Action<IAudioClient> configAction = null, bool external = false) | |||||
| public async Task<IAudioClient> ConnectAsync(bool selfDeaf = false, bool selfMute = false, bool external = false) | |||||
| { | { | ||||
| return await Guild.ConnectAudioAsync(Id, false, false, configAction, external).ConfigureAwait(false); | |||||
| return await Guild.ConnectAudioAsync(Id, selfDeaf, selfMute, external).ConfigureAwait(false); | |||||
| } | } | ||||
| public async Task DisconnectAsync() | public async Task DisconnectAsync() | ||||
| @@ -504,11 +504,8 @@ namespace Discord.WebSocket | |||||
| { | { | ||||
| return _audioClient?.GetInputStream(userId); | return _audioClient?.GetInputStream(userId); | ||||
| } | } | ||||
| internal async Task<IAudioClient> ConnectAudioAsync(ulong channelId, bool selfDeaf, bool selfMute, Action<IAudioClient> configAction, bool external) | |||||
| internal async Task<IAudioClient> ConnectAudioAsync(ulong channelId, bool selfDeaf, bool selfMute, bool external) | |||||
| { | { | ||||
| selfDeaf = false; | |||||
| selfMute = false; | |||||
| TaskCompletionSource<AudioClient> promise; | TaskCompletionSource<AudioClient> promise; | ||||
| await _audioLock.WaitAsync().ConfigureAwait(false); | await _audioLock.WaitAsync().ConfigureAwait(false); | ||||
| @@ -548,7 +545,6 @@ namespace Discord.WebSocket | |||||
| var _ = promise.TrySetResultAsync(_audioClient); | var _ = promise.TrySetResultAsync(_audioClient); | ||||
| return Task.Delay(0); | return Task.Delay(0); | ||||
| }; | }; | ||||
| configAction?.Invoke(audioClient); | |||||
| _audioClient = audioClient; | _audioClient = audioClient; | ||||
| } | } | ||||