[Feature] Add missing VoiceChannel properties (#2573)

* add missing properties

* forgot about `MockedVoiceChannel`
This commit is contained in:
Misha133
2023-02-06 15:25:59 +03:00
committed by GitHub
parent 0af835ab0f
commit 1e21a6ed4a
9 changed files with 45 additions and 0 deletions

View File

@@ -26,6 +26,11 @@ namespace Discord
/// </returns>
int? UserLimit { get; }
/// <summary>
/// Gets the video quality mode for this channel.
/// </summary>
VideoQualityMode VideoQualityMode { get; }
/// <summary>
/// Bulk-deletes multiple messages.
/// </summary>

View File

@@ -0,0 +1,17 @@
namespace Discord;
/// <summary>
/// Represents a video quality mode for voice channels.
/// </summary>
public enum VideoQualityMode
{
/// <summary>
/// Discord chooses the quality for optimal performance.
/// </summary>
Auto = 1,
/// <summary>
/// 720p.
/// </summary>
Full = 2
}

View File

@@ -17,5 +17,10 @@ namespace Discord
/// Gets or sets the channel voice region id, automatic when set to <see langword="null"/>.
/// </summary>
public Optional<string> RTCRegion { get; set; }
/// <summary>
/// Get or sets the video quality mode for this channel.
/// </summary>
public Optional<VideoQualityMode> VideoQualityMode { get; set; }
}
}

View File

@@ -43,6 +43,9 @@ namespace Discord.API
[JsonProperty("rtc_region")]
public Optional<string> RTCRegion { get; set; }
[JsonProperty("video_quality_mode")]
public Optional<VideoQualityMode> VideoQualityMode { get; set; }
//PrivateChannel
[JsonProperty("recipients")]
public Optional<User[]> Recipients { get; set; }

View File

@@ -31,6 +31,10 @@ namespace Discord.API.Rest
public Optional<int> Bitrate { get; set; }
[JsonProperty("user_limit")]
public Optional<int?> UserLimit { get; set; }
[JsonProperty("video_quality_mode")]
public Optional<VideoQualityMode> VideoQuality { get; set; }
[JsonProperty("rtc_region")]
public Optional<string> RtcRegion { get; set; }
//Forum channels
[JsonProperty("default_reaction_emoji")]

View File

@@ -26,6 +26,8 @@ namespace Discord.Rest
public int? UserLimit { get; private set; }
/// <inheritdoc/>
public string RTCRegion { get; private set; }
/// <inheritdoc/>
public VideoQualityMode VideoQualityMode { get; private set; }
internal RestVoiceChannel(BaseDiscordClient discord, IGuild guild, ulong id)
: base(discord, guild, id)
@@ -48,6 +50,8 @@ namespace Discord.Rest
if(model.UserLimit.IsSpecified)
UserLimit = model.UserLimit.Value != 0 ? model.UserLimit.Value : (int?)null;
VideoQualityMode = model.VideoQualityMode.GetValueOrDefault(VideoQualityMode.Auto);
RTCRegion = model.RTCRegion.GetValueOrDefault(null);
}

View File

@@ -285,6 +285,8 @@ namespace Discord.Rest
Deny = overwrite.Permissions.DenyValue.ToString()
}).ToArray()
: Optional.Create<API.Overwrite[]>(),
VideoQuality = props.VideoQualityMode,
RtcRegion = props.RTCRegion
};
var model = await client.ApiClient.CreateGuildChannelAsync(guild.Id, args, options).ConfigureAwait(false);
return RestVoiceChannel.Create(client, guild, model);

View File

@@ -34,6 +34,8 @@ namespace Discord.WebSocket
public int? UserLimit { get; private set; }
/// <inheritdoc />
public string RTCRegion { get; private set; }
/// <inheritdoc/>
public VideoQualityMode VideoQualityMode { get; private set; }
/// <summary>
/// Gets a collection of users that are currently connected to this voice channel.
@@ -60,6 +62,7 @@ namespace Discord.WebSocket
base.Update(state, model);
Bitrate = model.Bitrate.GetValueOrDefault(64000);
UserLimit = model.UserLimit.GetValueOrDefault() != 0 ? model.UserLimit.Value : (int?)null;
VideoQualityMode = model.VideoQualityMode.GetValueOrDefault(VideoQualityMode.Auto);
RTCRegion = model.RTCRegion.GetValueOrDefault(null);
}

View File

@@ -38,6 +38,8 @@ namespace Discord
public ChannelFlags Flags => throw new NotImplementedException();
public VideoQualityMode VideoQualityMode => throw new NotImplementedException();
public Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null) => throw new NotImplementedException();
public Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null) => throw new NotImplementedException();
public Task<IAudioClient> ConnectAsync(bool selfDeaf = false, bool selfMute = false, bool external = false) => throw new NotImplementedException();