diff --git a/src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs b/src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs index dfab58f07..a52d41b3f 100644 --- a/src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs +++ b/src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs @@ -9,6 +9,14 @@ namespace Discord /// public interface IAudioChannel : IChannel { + /// + /// Gets the RTC region for this audio channel. + /// + /// + /// This property can be . + /// + string RTCRegion { get; } + /// /// Connects to this audio channel. /// diff --git a/src/Discord.Net.Rest/API/Common/Channel.cs b/src/Discord.Net.Rest/API/Common/Channel.cs index afd219b63..d565b269a 100644 --- a/src/Discord.Net.Rest/API/Common/Channel.cs +++ b/src/Discord.Net.Rest/API/Common/Channel.cs @@ -40,6 +40,8 @@ namespace Discord.API public Optional Bitrate { get; set; } [JsonProperty("user_limit")] public Optional UserLimit { get; set; } + [JsonProperty("rtc_region")] + public Optional RTCRegion { get; set; } //PrivateChannel [JsonProperty("recipients")] diff --git a/src/Discord.Net.Rest/Entities/Channels/RestGroupChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestGroupChannel.cs index 1240f6d67..03858fbbe 100644 --- a/src/Discord.Net.Rest/Entities/Channels/RestGroupChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/RestGroupChannel.cs @@ -22,6 +22,8 @@ namespace Discord.Rest /// public string Name { get; private set; } + /// + public string RTCRegion { get; private set; } public IReadOnlyCollection Users => _users.ToReadOnlyCollection(); public IReadOnlyCollection Recipients @@ -46,6 +48,8 @@ namespace Discord.Rest if (model.Recipients.IsSpecified) UpdateUsers(model.Recipients.Value); + + RTCRegion = model.RTCRegion.GetValueOrDefault(null); } internal void UpdateUsers(API.User[] models) { diff --git a/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs index 98ff6ac6e..bcf03a5bc 100644 --- a/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs @@ -21,6 +21,8 @@ namespace Discord.Rest public int? UserLimit { get; private set; } /// public ulong? CategoryId { get; private set; } + /// + public string RTCRegion { get; private set; } /// public string Mention => MentionUtils.MentionChannel(Id); @@ -46,6 +48,8 @@ namespace Discord.Rest if(model.UserLimit.IsSpecified) UserLimit = model.UserLimit.Value != 0 ? model.UserLimit.Value : (int?)null; + + RTCRegion = model.RTCRegion.GetValueOrDefault(null); } /// diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketGroupChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketGroupChannel.cs index 0451f97ab..c8137784f 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketGroupChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketGroupChannel.cs @@ -30,6 +30,9 @@ namespace Discord.WebSocket /// public string Name { get; private set; } + /// + public string RTCRegion { get; private set; } + /// public IReadOnlyCollection CachedMessages => _messages?.Messages ?? ImmutableArray.Create(); @@ -67,6 +70,8 @@ namespace Discord.WebSocket if (model.Recipients.IsSpecified) UpdateUsers(state, model.Recipients.Value); + + RTCRegion = model.RTCRegion.GetValueOrDefault(null); } private void UpdateUsers(ClientState state, UserModel[] models) { diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketVoiceChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketVoiceChannel.cs index 498862697..00003d4ed 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketVoiceChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketVoiceChannel.cs @@ -21,6 +21,8 @@ namespace Discord.WebSocket public int Bitrate { get; private set; } /// public int? UserLimit { get; private set; } + /// + public string RTCRegion { get; private set; } /// public ulong? CategoryId { get; private set; } @@ -66,6 +68,7 @@ namespace Discord.WebSocket CategoryId = model.CategoryId; Bitrate = model.Bitrate.Value; UserLimit = model.UserLimit.Value != 0 ? model.UserLimit.Value : (int?)null; + RTCRegion = model.RTCRegion.GetValueOrDefault(null); } /// diff --git a/test/Discord.Net.Tests.Unit/MockedEntities/MockedGroupChannel.cs b/test/Discord.Net.Tests.Unit/MockedEntities/MockedGroupChannel.cs index 3330b7bce..9c94efffa 100644 --- a/test/Discord.Net.Tests.Unit/MockedEntities/MockedGroupChannel.cs +++ b/test/Discord.Net.Tests.Unit/MockedEntities/MockedGroupChannel.cs @@ -16,6 +16,8 @@ namespace Discord public ulong Id => throw new NotImplementedException(); + public string RTCRegion => throw new NotImplementedException(); + public Task ConnectAsync(bool selfDeaf = false, bool selfMute = false, bool external = false) { throw new NotImplementedException(); diff --git a/test/Discord.Net.Tests.Unit/MockedEntities/MockedVoiceChannel.cs b/test/Discord.Net.Tests.Unit/MockedEntities/MockedVoiceChannel.cs index e053636a9..533b1b1b5 100644 --- a/test/Discord.Net.Tests.Unit/MockedEntities/MockedVoiceChannel.cs +++ b/test/Discord.Net.Tests.Unit/MockedEntities/MockedVoiceChannel.cs @@ -29,6 +29,8 @@ namespace Discord public DateTimeOffset CreatedAt => throw new NotImplementedException(); public ulong Id => throw new NotImplementedException(); + public string RTCRegion => throw new NotImplementedException(); + public Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null) { throw new NotImplementedException();