From 3aa479bceefa2aca3edb656f42ce1e2e5a3568fd Mon Sep 17 00:00:00 2001 From: Paulo Date: Tue, 17 Nov 2020 03:37:15 -0300 Subject: [PATCH] Change xml docs and PremiumSubscriptionCount type --- .../Entities/Guilds/GuildWidgetProperties.cs | 4 +- .../Entities/Guilds/IGuild.cs | 103 +++++++++--------- src/Discord.Net.Rest/API/Common/Guild.cs | 2 +- .../Entities/Guilds/RestGuild.cs | 3 +- .../Entities/Guilds/SocketGuild.cs | 3 +- 5 files changed, 58 insertions(+), 57 deletions(-) diff --git a/src/Discord.Net.Core/Entities/Guilds/GuildWidgetProperties.cs b/src/Discord.Net.Core/Entities/Guilds/GuildWidgetProperties.cs index 7714f5202..842bb7f3e 100644 --- a/src/Discord.Net.Core/Entities/Guilds/GuildWidgetProperties.cs +++ b/src/Discord.Net.Core/Entities/Guilds/GuildWidgetProperties.cs @@ -10,11 +10,11 @@ namespace Discord /// public Optional Enabled { get; set; } /// - /// Sets the channel that the invite should place its users in, if not null. + /// Sets the channel that the invite should place its users in, if not . /// public Optional Channel { get; set; } /// - /// Sets the channel the invite should place its users in, if not null. + /// Sets the channel that the invite should place its users in, if not . /// public Optional ChannelId { get; set; } } diff --git a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs index efd348e2e..9500c7f08 100644 --- a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs +++ b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs @@ -23,7 +23,7 @@ namespace Discord /// automatically moved to the AFK voice channel. /// /// - /// An representing the amount of time in seconds for a user to be marked as inactive + /// An representing the amount of time in seconds for a user to be marked as inactive /// and moved into the AFK voice channel. /// int AFKTimeout { get; } @@ -31,14 +31,14 @@ namespace Discord /// Gets a value that indicates whether this guild is embeddable (i.e. can use widget). /// /// - /// true if this guild can be embedded via widgets; otherwise false. + /// if this guild has a widget enabled; otherwise . /// bool IsEmbeddable { get; } /// /// Gets a value that indicates whether this guild has the widget enabled. /// /// - /// true if this guild has a widget enabled; otherwise false. + /// if this guild has a widget enabled; otherwise . /// bool IsWidgetEnabled { get; } /// @@ -71,42 +71,42 @@ namespace Discord /// Gets the ID of this guild's icon. /// /// - /// An identifier for the splash image; null if none is set. + /// An identifier for the splash image; if none is set. /// string IconId { get; } /// /// Gets the URL of this guild's icon. /// /// - /// A URL pointing to the guild's icon; null if none is set. + /// A URL pointing to the guild's icon; if none is set. /// string IconUrl { get; } /// /// Gets the ID of this guild's splash image. /// /// - /// An identifier for the splash image; null if none is set. + /// An identifier for the splash image; if none is set. /// string SplashId { get; } /// /// Gets the URL of this guild's splash image. /// /// - /// A URL pointing to the guild's splash image; null if none is set. + /// A URL pointing to the guild's splash image; if none is set. /// string SplashUrl { get; } /// /// Gets the ID of this guild's discovery splash image. /// /// - /// An identifier for the discovery splash image; null if none is set. + /// An identifier for the discovery splash image; if none is set. /// string DiscoverySplashId { get; } /// /// Gets the URL of this guild's discovery splash image. /// /// - /// A URL pointing to the guild's discovery splash image; null if none is set. + /// A URL pointing to the guild's discovery splash image; if none is set. /// string DiscoverySplashUrl { get; } /// @@ -119,7 +119,7 @@ namespace Discord /// This boolean is used to determine if the guild is currently connected to the WebSocket and is ready to be used/accessed. /// /// - /// true if this guild is currently connected and ready to be used; otherwise false. + /// true if this guild is currently connected and ready to be used; otherwise . /// bool Available { get; } @@ -127,7 +127,7 @@ namespace Discord /// Gets the ID of the AFK voice channel for this guild. /// /// - /// A representing the snowflake identifier of the AFK voice channel; null if + /// A representing the snowflake identifier of the AFK voice channel; if /// none is set. /// ulong? AFKChannelId { get; } @@ -142,7 +142,7 @@ namespace Discord /// /// /// - /// A representing the snowflake identifier of the default text channel; 0 if + /// A representing the snowflake identifier of the default text channel; 0 if /// none can be found. /// ulong DefaultChannelId { get; } @@ -150,55 +150,54 @@ namespace Discord /// Gets the ID of the widget embed channel of this guild. /// /// - /// A representing the snowflake identifier of the embedded channel found within the - /// widget settings of this guild; null if none is set. + /// A representing the snowflake identifier of the embedded channel found within the + /// widget settings of this guild; if none is set. /// ulong? EmbedChannelId { get; } /// /// Gets the ID of the channel assigned to the widget of this guild. /// /// - /// A representing the snowflake identifier of the channel assigned to the widget found - /// within the widget settings of this guild; null if none is set. + /// A representing the snowflake identifier of the channel assigned to the widget found + /// within the widget settings of this guild; if none is set. /// ulong? WidgetChannelId { get; } /// /// Gets the ID of the channel where randomized welcome messages are sent. /// /// - /// A representing the snowflake identifier of the system channel where randomized - /// welcome messages are sent; null if none is set. + /// A representing the snowflake identifier of the system channel where randomized + /// welcome messages are sent; if none is set. /// ulong? SystemChannelId { get; } /// /// Gets the ID of the channel with the rules. /// /// - /// A representing the snowflake identifier of the channel that contains the rules; - /// null if none is set. + /// A representing the snowflake identifier of the channel that contains the rules; + /// if none is set. /// ulong? RulesChannelId { get; } /// - /// Gets the ID of the channel where admins and moderators of guilds with the "PUBLIC" feature - /// receive notices from Discord. + /// Gets the ID of the channel where admins and moderators of Community guilds receive notices from Discord. /// /// - /// A representing the snowflake identifier of the channel where admins and moderators - /// of guilds with the "PUBLIC" feature receive notices from Discord; null if none is set. + /// A representing the snowflake identifier of the channel where admins and moderators + /// of Community guilds receive notices from Discord; if none is set. /// ulong? PublicUpdatesChannelId { get; } /// /// Gets the ID of the user that owns this guild. /// /// - /// A representing the snowflake identifier of the user that owns this guild. + /// A representing the snowflake identifier of the user that owns this guild. /// ulong OwnerId { get; } /// /// Gets the application ID of the guild creator if it is bot-created. /// /// - /// A representing the snowflake identifier of the application ID that created this guild, or null if it was not bot-created. + /// A representing the snowflake identifier of the application ID that created this guild, or if it was not bot-created. /// ulong? ApplicationId { get; } /// @@ -254,21 +253,21 @@ namespace Discord /// Gets the identifier for this guilds banner image. /// /// - /// An identifier for the banner image; null if none is set. + /// An identifier for the banner image; if none is set. /// string BannerId { get; } /// /// Gets the URL of this guild's banner image. /// /// - /// A URL pointing to the guild's banner image; null if none is set. + /// A URL pointing to the guild's banner image; if none is set. /// string BannerUrl { get; } /// /// Gets the code for this guild's vanity invite URL. /// /// - /// A string containing the vanity invite code for this guild; null if none is set. + /// A string containing the vanity invite code for this guild; if none is set. /// string VanityURLCode { get; } /// @@ -282,7 +281,7 @@ namespace Discord /// Gets the description for the guild. /// /// - /// The description for the guild; null if none is set. + /// The description for the guild; if none is set. /// string Description { get; } /// @@ -292,7 +291,7 @@ namespace Discord /// This is the number of users who have boosted this guild. /// /// - /// The number of premium subscribers of this guild. + /// The number of premium subscribers of this guild; if not available. /// int PremiumSubscriptionCount { get; } /// @@ -433,7 +432,7 @@ namespace Discord /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains a ban object, which - /// contains the user information and the reason for the ban; null if the ban entry cannot be found. + /// contains the user information and the reason for the ban; if the ban entry cannot be found. /// Task GetBanAsync(IUser user, RequestOptions options = null); /// @@ -443,7 +442,7 @@ namespace Discord /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains a ban object, which - /// contains the user information and the reason for the ban; null if the ban entry cannot be found. + /// contains the user information and the reason for the ban; if the ban entry cannot be found. /// Task GetBanAsync(ulong userId, RequestOptions options = null); /// @@ -507,7 +506,7 @@ namespace Discord /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the generic channel - /// associated with the specified ; null if none is found. + /// associated with the specified ; if none is found. /// Task GetChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); /// @@ -528,7 +527,7 @@ namespace Discord /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the text channel - /// associated with the specified ; null if none is found. + /// associated with the specified ; if none is found. /// Task GetTextChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); /// @@ -559,7 +558,7 @@ namespace Discord /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the voice channel associated - /// with the specified ; null if none is found. + /// with the specified ; if none is found. /// Task GetVoiceChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); /// @@ -569,7 +568,7 @@ namespace Discord /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the voice channel that the - /// AFK users will be moved to after they have idled for too long; null if none is set. + /// AFK users will be moved to after they have idled for too long; if none is set. /// Task GetAFKChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); /// @@ -579,7 +578,7 @@ namespace Discord /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the text channel where - /// randomized welcome messages will be sent to; null if none is set. + /// randomized welcome messages will be sent to; if none is set. /// Task GetSystemChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); /// @@ -589,7 +588,7 @@ namespace Discord /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the first viewable text - /// channel in this guild; null if none is found. + /// channel in this guild; if none is found. /// Task GetDefaultChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); /// @@ -599,7 +598,7 @@ namespace Discord /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the embed channel set - /// within the server's widget settings; null if none is set. + /// within the server's widget settings; if none is set. /// [Obsolete("This endpoint is deprecated, use GetWidgetChannelAsync instead.")] Task GetEmbedChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); @@ -610,27 +609,27 @@ namespace Discord /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the widget channel set - /// within the server's widget settings; null if none is set. + /// within the server's widget settings; if none is set. /// Task GetWidgetChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); /// - /// Gets the text channel where guilds with the "PUBLIC" feature can display rules and/or guidelines. + /// Gets the text channel where Community guilds can display rules and/or guidelines. /// /// The that determines whether the object should be fetched from cache. /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the text channel - /// where guilds with the "PUBLIC" feature can display rules and/or guidelines; null if none is set. + /// where Community guilds can display rules and/or guidelines; if none is set. /// Task GetRulesChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); /// - /// Gets the text channel channel where admins and moderators of guilds with the "PUBLIC" feature receive notices from Discord. + /// Gets the text channel channel where admins and moderators of Community guilds receive notices from Discord. /// /// The that determines whether the object should be fetched from cache. /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the text channel channel where - /// admins and moderators of guilds with the "PUBLIC" feature receive notices from Discord; null if none is set. + /// admins and moderators of Community guilds receive notices from Discord; if none is set. /// Task GetPublicUpdatesChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); @@ -701,7 +700,7 @@ namespace Discord /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the partial metadata of - /// the vanity invite found within this guild; null if none is found. + /// the vanity invite found within this guild; if none is found. /// Task GetVanityInviteAsync(RequestOptions options = null); @@ -710,7 +709,7 @@ namespace Discord /// /// The snowflake identifier for the role. /// - /// A role that is associated with the specified ; null if none is found. + /// A role that is associated with the specified ; if none is found. /// IRole GetRole(ulong id); /// @@ -752,7 +751,7 @@ namespace Discord /// The OAuth2 access token for the user, requested with the guilds.join scope. /// The delegate containing the properties to be applied to the user upon being added to the guild. /// The options to be used when sending the request. - /// A guild user associated with the specified ; null if the user is already in the guild. + /// A guild user associated with the specified ; if the user is already in the guild. Task AddGuildUserAsync(ulong userId, string accessToken, Action func = null, RequestOptions options = null); /// /// Gets a collection of all users in this guild. @@ -777,7 +776,7 @@ namespace Discord /// /// This method retrieves a user found within this guild. /// - /// This may return null in the WebSocket implementation due to incomplete user collection in + /// This may return in the WebSocket implementation due to incomplete user collection in /// large guilds. /// /// @@ -786,7 +785,7 @@ namespace Discord /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the guild user - /// associated with the specified ; null if none is found. + /// associated with the specified ; if none is found. /// Task GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); /// @@ -879,7 +878,7 @@ namespace Discord /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the webhook with the - /// specified ; null if none is found. + /// specified ; if none is found. /// Task GetWebhookAsync(ulong id, RequestOptions options = null); /// @@ -899,7 +898,7 @@ namespace Discord /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the emote found with the - /// specified ; null if none is found. + /// specified ; if none is found. /// Task GetEmoteAsync(ulong id, RequestOptions options = null); /// diff --git a/src/Discord.Net.Rest/API/Common/Guild.cs b/src/Discord.Net.Rest/API/Common/Guild.cs index 46075ce4d..414929a7b 100644 --- a/src/Discord.Net.Rest/API/Common/Guild.cs +++ b/src/Discord.Net.Rest/API/Common/Guild.cs @@ -69,7 +69,7 @@ namespace Discord.API [JsonProperty("max_members")] public Optional MaxMembers { get; set; } [JsonProperty("premium_subscription_count")] - public int? PremiumSubscriptionCount { get; set; } + public Optional PremiumSubscriptionCount { get; set; } [JsonProperty("preferred_locale")] public string PreferredLocale { get; set; } [JsonProperty("public_updates_channel_id")] diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs index b67436f9f..5f6693926 100644 --- a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs +++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs @@ -161,7 +161,8 @@ namespace Discord.Rest BannerId = model.Banner; SystemChannelFlags = model.SystemChannelFlags; Description = model.Description; - PremiumSubscriptionCount = model.PremiumSubscriptionCount.GetValueOrDefault(); + if (model.PremiumSubscriptionCount.IsSpecified) + PremiumSubscriptionCount = model.PremiumSubscriptionCount.Value; if (model.MaxPresences.IsSpecified) MaxPresences = model.MaxPresences.Value ?? 25000; if (model.MaxMembers.IsSpecified) diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs index 88ce429db..5e2dedbcf 100644 --- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs +++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs @@ -448,7 +448,8 @@ namespace Discord.WebSocket BannerId = model.Banner; SystemChannelFlags = model.SystemChannelFlags; Description = model.Description; - PremiumSubscriptionCount = model.PremiumSubscriptionCount.GetValueOrDefault(); + if (model.PremiumSubscriptionCount.IsSpecified) + PremiumSubscriptionCount = model.PremiumSubscriptionCount.Value; if (model.MaxPresences.IsSpecified) MaxPresences = model.MaxPresences.Value ?? 25000; if (model.MaxMembers.IsSpecified)