Allow clients to send 'Gateway Voice State Update' command (#1888)

* Expose SendVoiceStateUpdateAsync API to clients

Fixes #1882

* Revert "Expose SendVoiceStateUpdateAsync API to clients"

This reverts commit 1a11cae7

* Add IAudioChannel.ModifyAsync API

* fix NRE with request options

Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com>
Co-authored-by: quin lynch <lynchquin@gmail.com>
This commit is contained in:
ppaneksamsung
2021-12-19 08:42:08 +01:00
committed by GitHub
parent 6c7502da68
commit a4b0c4f1e3
10 changed files with 98 additions and 3 deletions

View File

@@ -0,0 +1,18 @@
namespace Discord
{
/// <summary>
/// Provides properties that are used to modify an <see cref="IAudioChannel" /> with the specified changes.
/// </summary>
public class AudioChannelProperties
{
/// <summary>
/// Sets whether the user should be muted.
/// </summary>
public Optional<bool> SelfMute { get; set; }
/// <summary>
/// Sets whether the user should be deafened.
/// </summary>
public Optional<bool> SelfDeaf { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
using Discord.Audio;
using System;
using System.Threading.Tasks;
namespace Discord
@@ -27,5 +28,16 @@ namespace Discord
/// A task representing the asynchronous operation for disconnecting from the audio channel.
/// </returns>
Task DisconnectAsync();
/// <summary>
/// Modifies this audio channel.
/// </summary>
/// <param name="func">The properties to modify the channel with.</param>
/// <param name="options">The options to be used when sending the request.</param>
/// <returns>
/// A task that represents the asynchronous modification operation.
/// </returns>
/// <seealso cref="AudioChannelProperties"/>
Task ModifyAsync(Action<AudioChannelProperties> func, RequestOptions options = null);
}
}