[Feature] Voice channel status support (#2777)

* initial commit

* MOCKED CHANNELS AGRHHHHHHHH

* fix for sharded

* yup
This commit is contained in:
Mihail Gribkov
2023-11-18 23:42:14 +03:00
committed by GitHub
parent 8e4d449615
commit 8060dcf4ae
30 changed files with 323 additions and 17 deletions

View File

@@ -38,6 +38,11 @@ namespace Discord.WebSocket
/// <inheritdoc/>
public VideoQualityMode VideoQualityMode { get; private set; }
/// <summary>
/// Gets the voice channel status set in this channel. <see langword="null" /> if it is not set.
/// </summary>
public virtual string Status { get; private set; }
/// <summary>
/// Gets a collection of users that are currently connected to this voice channel.
/// </summary>
@@ -51,12 +56,19 @@ namespace Discord.WebSocket
: base(discord, id, guild)
{
}
internal new static SocketVoiceChannel Create(SocketGuild guild, ClientState state, Model model)
{
var entity = new SocketVoiceChannel(guild?.Discord, model.Id, guild);
entity.Update(state, model);
return entity;
}
internal void UpdateVoiceStatus(string status)
{
Status = status;
}
/// <inheritdoc />
internal override void Update(ClientState state, Model model)
{
@@ -65,8 +77,13 @@ namespace Discord.WebSocket
UserLimit = model.UserLimit.GetValueOrDefault() != 0 ? model.UserLimit.Value : (int?)null;
VideoQualityMode = model.VideoQualityMode.GetValueOrDefault(VideoQualityMode.Auto);
RTCRegion = model.RTCRegion.GetValueOrDefault(null);
Status = model.Status.GetValueOrDefault(null);
}
/// <inheritdoc />
public virtual Task SetStatusAsync(string status, RequestOptions options = null)
=> ChannelHelper.ModifyVoiceChannelStatusAsync(this, status, Discord, options);
/// <inheritdoc />
public Task ModifyAsync(Action<VoiceChannelProperties> func, RequestOptions options = null)
=> ChannelHelper.ModifyAsync(this, Discord, func, options);