From 28f5d728150de27ab2cbac9e490ed460e19b8d91 Mon Sep 17 00:00:00 2001 From: NovusTheory Date: Mon, 28 May 2018 16:41:07 -0500 Subject: [PATCH] Update IAudioChannel.ConnectAsync() - Remove ConfigAction from parameters - Add SelfDeafen/SelfMute to parameters --- src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs | 2 +- src/Discord.Net.Rest/Entities/Channels/RestGroupChannel.cs | 2 +- src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs | 2 +- .../Entities/Channels/SocketGroupChannel.cs | 2 +- .../Entities/Channels/SocketVoiceChannel.cs | 4 ++-- src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs | 6 +----- 6 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs b/src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs index ebcb5769e..a152ff744 100644 --- a/src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs +++ b/src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs @@ -7,7 +7,7 @@ namespace Discord public interface IAudioChannel : IChannel { /// Connects to this audio channel. - Task ConnectAsync(Action configAction = null, bool external = false); + Task ConnectAsync(bool selfDeaf = false, bool selfMute = false, bool external = false); /// Disconnects from this audio channel. Task DisconnectAsync(); diff --git a/src/Discord.Net.Rest/Entities/Channels/RestGroupChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestGroupChannel.cs index 4564ce4bc..702fca6e0 100644 --- a/src/Discord.Net.Rest/Entities/Channels/RestGroupChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/RestGroupChannel.cs @@ -143,7 +143,7 @@ namespace Discord.Rest => EnterTypingState(options); //IAudioChannel - Task IAudioChannel.ConnectAsync(Action configAction, bool external) { throw new NotSupportedException(); } + Task IAudioChannel.ConnectAsync(bool selfDeaf, bool selfMute, bool external) { throw new NotSupportedException(); } Task IAudioChannel.DisconnectAsync() { throw new NotSupportedException(); } //IChannel diff --git a/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs index 85d05127a..5eacd292a 100644 --- a/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs @@ -41,7 +41,7 @@ namespace Discord.Rest private string DebuggerDisplay => $"{Name} ({Id}, Voice)"; //IAudioChannel - Task IAudioChannel.ConnectAsync(Action configAction, bool external) { throw new NotSupportedException(); } + Task IAudioChannel.ConnectAsync(bool selfDeaf, bool selfMute, bool external) { throw new NotSupportedException(); } Task IAudioChannel.DisconnectAsync() { throw new NotSupportedException(); } //IGuildChannel diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketGroupChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketGroupChannel.cs index bd15e8955..b2616aeff 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketGroupChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketGroupChannel.cs @@ -206,7 +206,7 @@ namespace Discord.WebSocket => EnterTypingState(options); //IAudioChannel - Task IAudioChannel.ConnectAsync(Action configAction, bool external) { throw new NotSupportedException(); } + Task IAudioChannel.ConnectAsync(bool selfDeaf, bool selfMute, bool external) { throw new NotSupportedException(); } Task IAudioChannel.DisconnectAsync() { throw new NotSupportedException(); } //IChannel diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketVoiceChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketVoiceChannel.cs index 5473a75c1..1d207837b 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketVoiceChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketVoiceChannel.cs @@ -40,9 +40,9 @@ namespace Discord.WebSocket public Task ModifyAsync(Action func, RequestOptions options = null) => ChannelHelper.ModifyAsync(this, Discord, func, options); - public async Task ConnectAsync(Action configAction = null, bool external = false) + public async Task 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() diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs index 5aec0a1f4..fd213a3eb 100644 --- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs +++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs @@ -504,11 +504,8 @@ namespace Discord.WebSocket { return _audioClient?.GetInputStream(userId); } - internal async Task ConnectAudioAsync(ulong channelId, bool selfDeaf, bool selfMute, Action configAction, bool external) + internal async Task ConnectAudioAsync(ulong channelId, bool selfDeaf, bool selfMute, bool external) { - selfDeaf = false; - selfMute = false; - TaskCompletionSource promise; await _audioLock.WaitAsync().ConfigureAwait(false); @@ -548,7 +545,6 @@ namespace Discord.WebSocket var _ = promise.TrySetResultAsync(_audioClient); return Task.Delay(0); }; - configAction?.Invoke(audioClient); _audioClient = audioClient; }