| @@ -8,8 +8,8 @@ namespace Discord | |||||
| { | { | ||||
| /// <summary> Gets the bitrate, in bits per second, clients in this voice channel are requested to use. </summary> | /// <summary> Gets the bitrate, in bits per second, clients in this voice channel are requested to use. </summary> | ||||
| int Bitrate { get; } | int Bitrate { get; } | ||||
| /// <summary> Gets the max amount of users allowed to be connected to this channel at one time. A value of 0 represents no limit. </summary> | |||||
| int UserLimit { get; } | |||||
| /// <summary> Gets the max amount of users allowed to be connected to this channel at one time. </summary> | |||||
| int? UserLimit { get; } | |||||
| /// <summary> Modifies this voice channel. </summary> | /// <summary> Modifies this voice channel. </summary> | ||||
| Task ModifyAsync(Action<VoiceChannelProperties> func, RequestOptions options = null); | Task ModifyAsync(Action<VoiceChannelProperties> func, RequestOptions options = null); | ||||
| @@ -10,6 +10,6 @@ | |||||
| /// <summary> | /// <summary> | ||||
| /// The maximum number of users that can be present in a channel. | /// The maximum number of users that can be present in a channel. | ||||
| /// </summary> | /// </summary> | ||||
| public Optional<int> UserLimit { get; set; } | |||||
| public Optional<int?> UserLimit { get; set; } | |||||
| } | } | ||||
| } | } | ||||
| @@ -56,7 +56,7 @@ namespace Discord.Rest | |||||
| Bitrate = args.Bitrate, | Bitrate = args.Bitrate, | ||||
| Name = args.Name, | Name = args.Name, | ||||
| Position = args.Position, | Position = args.Position, | ||||
| UserLimit = args.UserLimit | |||||
| UserLimit = args.UserLimit.IsSpecified ? (args.UserLimit.Value ?? 0) : Optional.Create<int>() | |||||
| }; | }; | ||||
| return await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false); | return await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false); | ||||
| } | } | ||||
| @@ -1,5 +1,4 @@ | |||||
| using Discord.API.Rest; | |||||
| using Discord.Audio; | |||||
| using Discord.Audio; | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Diagnostics; | using System.Diagnostics; | ||||
| @@ -13,7 +12,7 @@ namespace Discord.Rest | |||||
| public class RestVoiceChannel : RestGuildChannel, IVoiceChannel, IRestAudioChannel | public class RestVoiceChannel : RestGuildChannel, IVoiceChannel, IRestAudioChannel | ||||
| { | { | ||||
| public int Bitrate { get; private set; } | public int Bitrate { get; private set; } | ||||
| public int UserLimit { get; private set; } | |||||
| public int? UserLimit { get; private set; } | |||||
| internal RestVoiceChannel(BaseDiscordClient discord, IGuild guild, ulong id) | internal RestVoiceChannel(BaseDiscordClient discord, IGuild guild, ulong id) | ||||
| : base(discord, guild, id) | : base(discord, guild, id) | ||||
| @@ -30,7 +29,7 @@ namespace Discord.Rest | |||||
| base.Update(model); | base.Update(model); | ||||
| Bitrate = model.Bitrate.Value; | Bitrate = model.Bitrate.Value; | ||||
| UserLimit = model.UserLimit.Value; | |||||
| UserLimit = model.UserLimit.Value != 0 ? model.UserLimit.Value : (int?)null; | |||||
| } | } | ||||
| public async Task ModifyAsync(Action<VoiceChannelProperties> func, RequestOptions options = null) | public async Task ModifyAsync(Action<VoiceChannelProperties> func, RequestOptions options = null) | ||||
| @@ -1,5 +1,4 @@ | |||||
| using Discord.API.Rest; | |||||
| using Discord.Audio; | |||||
| using Discord.Audio; | |||||
| using Discord.Rest; | using Discord.Rest; | ||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| @@ -14,8 +13,8 @@ namespace Discord.Rpc | |||||
| [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
| public class RpcVoiceChannel : RpcGuildChannel, IRpcAudioChannel, IVoiceChannel | public class RpcVoiceChannel : RpcGuildChannel, IRpcAudioChannel, IVoiceChannel | ||||
| { | { | ||||
| public int UserLimit { get; private set; } | |||||
| public int Bitrate { get; private set; } | public int Bitrate { get; private set; } | ||||
| public int? UserLimit { get; private set; } | |||||
| public IReadOnlyCollection<RpcVoiceState> VoiceStates { get; private set; } | public IReadOnlyCollection<RpcVoiceState> VoiceStates { get; private set; } | ||||
| internal RpcVoiceChannel(DiscordRpcClient discord, ulong id, ulong guildId) | internal RpcVoiceChannel(DiscordRpcClient discord, ulong id, ulong guildId) | ||||
| @@ -32,7 +31,7 @@ namespace Discord.Rpc | |||||
| { | { | ||||
| base.Update(model); | base.Update(model); | ||||
| if (model.UserLimit.IsSpecified) | if (model.UserLimit.IsSpecified) | ||||
| UserLimit = model.UserLimit.Value; | |||||
| UserLimit = model.UserLimit.Value != 0 ? model.UserLimit.Value : (int?)null; | |||||
| if (model.Bitrate.IsSpecified) | if (model.Bitrate.IsSpecified) | ||||
| Bitrate = model.Bitrate.Value; | Bitrate = model.Bitrate.Value; | ||||
| VoiceStates = model.VoiceStates.Select(x => RpcVoiceState.Create(Discord, x)).ToImmutableArray(); | VoiceStates = model.VoiceStates.Select(x => RpcVoiceState.Create(Discord, x)).ToImmutableArray(); | ||||
| @@ -1,5 +1,4 @@ | |||||
| using Discord.API.Rest; | |||||
| using Discord.Audio; | |||||
| using Discord.Audio; | |||||
| using Discord.Rest; | using Discord.Rest; | ||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| @@ -15,7 +14,7 @@ namespace Discord.WebSocket | |||||
| public class SocketVoiceChannel : SocketGuildChannel, IVoiceChannel, ISocketAudioChannel | public class SocketVoiceChannel : SocketGuildChannel, IVoiceChannel, ISocketAudioChannel | ||||
| { | { | ||||
| public int Bitrate { get; private set; } | public int Bitrate { get; private set; } | ||||
| public int UserLimit { get; private set; } | |||||
| public int? UserLimit { get; private set; } | |||||
| public override IReadOnlyCollection<SocketGuildUser> Users | public override IReadOnlyCollection<SocketGuildUser> Users | ||||
| => Guild.Users.Where(x => x.VoiceChannel?.Id == Id).ToImmutableArray(); | => Guild.Users.Where(x => x.VoiceChannel?.Id == Id).ToImmutableArray(); | ||||
| @@ -35,7 +34,7 @@ namespace Discord.WebSocket | |||||
| base.Update(state, model); | base.Update(state, model); | ||||
| Bitrate = model.Bitrate.Value; | Bitrate = model.Bitrate.Value; | ||||
| UserLimit = model.UserLimit.Value; | |||||
| UserLimit = model.UserLimit.Value != 0 ? model.UserLimit.Value : (int?)null; | |||||
| } | } | ||||
| public Task ModifyAsync(Action<VoiceChannelProperties> func, RequestOptions options = null) | public Task ModifyAsync(Action<VoiceChannelProperties> func, RequestOptions options = null) | ||||