diff --git a/src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs b/src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs
index 179f4b03e..6a869afd6 100644
--- a/src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs
+++ b/src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs
@@ -27,5 +27,13 @@ namespace Discord
/// A task representing the asynchronous operation for disconnecting from the audio channel.
///
Task DisconnectAsync();
+
+ ///
+ /// Sends voice state update of this audio channel.
+ ///
+ /// Determines whether the client should deaf itself.
+ /// Determines whether the client should mute itself.
+ ///
+ Task SendVoiceStateUpdateAsync(bool selfDeaf, bool selfMute);
}
}
diff --git a/src/Discord.Net.Rest/Entities/Channels/RestGroupChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestGroupChannel.cs
index 2b0ab8b42..bbaabc853 100644
--- a/src/Discord.Net.Rest/Entities/Channels/RestGroupChannel.cs
+++ b/src/Discord.Net.Rest/Entities/Channels/RestGroupChannel.cs
@@ -196,6 +196,7 @@ namespace Discord.Rest
/// Connecting to a group channel is not supported.
Task IAudioChannel.ConnectAsync(bool selfDeaf, bool selfMute, bool external) { throw new NotSupportedException(); }
Task IAudioChannel.DisconnectAsync() { throw new NotSupportedException(); }
+ Task IAudioChannel.SendVoiceStateUpdateAsync(bool selfDeaf, bool selfMute) { throw new NotSupportedException(); }
//IChannel
Task IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
diff --git a/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs
index 3f3aa96c6..26a9fccb7 100644
--- a/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs
+++ b/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs
@@ -76,6 +76,7 @@ namespace Discord.Rest
/// Connecting to a REST-based channel is not supported.
Task IAudioChannel.ConnectAsync(bool selfDeaf, bool selfMute, bool external) { throw new NotSupportedException(); }
Task IAudioChannel.DisconnectAsync() { throw new NotSupportedException(); }
+ Task IAudioChannel.SendVoiceStateUpdateAsync(bool selfDeaf, bool selfMute) { 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 ab8c76aeb..a46dc8adf 100644
--- a/src/Discord.Net.WebSocket/Entities/Channels/SocketGroupChannel.cs
+++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketGroupChannel.cs
@@ -311,6 +311,7 @@ namespace Discord.WebSocket
/// Connecting to a group channel is not supported.
Task IAudioChannel.ConnectAsync(bool selfDeaf, bool selfMute, bool external) { throw new NotSupportedException(); }
Task IAudioChannel.DisconnectAsync() { throw new NotSupportedException(); }
+ Task IAudioChannel.SendVoiceStateUpdateAsync(bool selfDeaf, bool selfMute) { 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 bf4a63c9f..876a66b84 100644
--- a/src/Discord.Net.WebSocket/Entities/Channels/SocketVoiceChannel.cs
+++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketVoiceChannel.cs
@@ -76,6 +76,11 @@ namespace Discord.WebSocket
public async Task DisconnectAsync()
=> await Guild.DisconnectAudioAsync();
+ public async Task SendVoiceStateUpdateAsync(bool selfDeaf, bool selfMute)
+ {
+ await Guild.SendVoiceStateUpdateAsync(Id, selfDeaf, selfMute);
+ }
+
///
public override SocketGuildUser GetUser(ulong id)
{
diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
index 9af4ad57e..3ed8368a3 100644
--- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
+++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
@@ -1131,6 +1131,12 @@ namespace Discord.WebSocket
_audioLock.Release();
}
}
+
+ internal async Task SendVoiceStateUpdateAsync(ulong channelId, bool selfDeaf, bool selfMute)
+ {
+ await Discord.ApiClient.SendVoiceStateUpdateAsync(Id, channelId, selfDeaf, selfMute).ConfigureAwait(false);
+ }
+
private async Task DisconnectAudioInternalAsync()
{
_audioConnectPromise?.TrySetCanceledAsync(); //Cancel any previous audio connection
diff --git a/test/Discord.Net.Tests.Unit/MockedEntities/MockedGroupChannel.cs b/test/Discord.Net.Tests.Unit/MockedEntities/MockedGroupChannel.cs
index 6daf6a9c8..9b9cd4766 100644
--- a/test/Discord.Net.Tests.Unit/MockedEntities/MockedGroupChannel.cs
+++ b/test/Discord.Net.Tests.Unit/MockedEntities/MockedGroupChannel.cs
@@ -41,6 +41,11 @@ namespace Discord
throw new NotImplementedException();
}
+ public Task SendVoiceStateUpdateAsync(bool selfDeaf, bool selfMute)
+ {
+ throw new NotImplementedException();
+ }
+
public IDisposable EnterTypingState(RequestOptions options = null)
{
throw new NotImplementedException();
diff --git a/test/Discord.Net.Tests.Unit/MockedEntities/MockedVoiceChannel.cs b/test/Discord.Net.Tests.Unit/MockedEntities/MockedVoiceChannel.cs
index eb617125d..712a16d88 100644
--- a/test/Discord.Net.Tests.Unit/MockedEntities/MockedVoiceChannel.cs
+++ b/test/Discord.Net.Tests.Unit/MockedEntities/MockedVoiceChannel.cs
@@ -58,6 +58,11 @@ namespace Discord
throw new NotImplementedException();
}
+ public Task SendVoiceStateUpdateAsync(bool selfDeaf, bool selfMute)
+ {
+ throw new NotImplementedException();
+ }
+
public Task GetCategoryAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)
{
throw new NotImplementedException();