Browse Source

Add `NsfwLevel` property to Guild (#80)

* Add `NsfwLevel` property to Guild
pull/1923/head
Nikon GitHub 4 years ago
parent
commit
8eda677825
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 122 additions and 7 deletions
  1. +69
    -0
      src/Discord.Net.Core/Discord.Net.Core.xml
  2. +8
    -0
      src/Discord.Net.Core/Entities/Guilds/IGuild.cs
  3. +22
    -0
      src/Discord.Net.Core/Entities/Guilds/NsfwLevel.cs
  4. +2
    -0
      src/Discord.Net.Rest/API/Common/Guild.cs
  5. +3
    -0
      src/Discord.Net.Rest/Discord.Net.Rest.xml
  6. +3
    -0
      src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
  7. +12
    -7
      src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml
  8. +3
    -0
      src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs

+ 69
- 0
src/Discord.Net.Core/Discord.Net.Core.xml View File

@@ -3114,6 +3114,14 @@
language tag format.
</returns>
</member>
<member name="P:Discord.IGuild.NsfwLevel">
<summary>
Gets the NSFW level of this guild.
</summary>
<returns>
The NSFW level of this guild.
</returns>
</member>
<member name="P:Discord.IGuild.PreferredCulture">
<summary>
Gets the preferred culture of this guild.
@@ -3891,6 +3899,26 @@
Users must have MFA enabled on their account to perform administrative actions.
</summary>
</member>
<member name="F:Discord.NsfwLevel.Default">
<summary>
Default or unset.
</summary>
</member>
<member name="F:Discord.NsfwLevel.Explicit">
<summary>
Guild has extremely suggestive or mature content that would only be suitable for users 18 or over.
</summary>
</member>
<member name="F:Discord.NsfwLevel.Safe">
<summary>
Guild has no content that could be deemed NSFW; in other words, SFW.
</summary>
</member>
<member name="F:Discord.NsfwLevel.AgeRestricted">
<summary>
Guild has mildly NSFW content that may not be suitable for users under 18.
</summary>
</member>
<member name="T:Discord.PermissionTarget">
<summary>
Specifies the target of the permission.
@@ -7554,10 +7582,38 @@
The message for when a news channel subscription is added to a text channel.
</summary>
</member>
<member name="F:Discord.MessageType.GuildDiscoveryDisqualified">
<summary>
The message for when a guild is disqualified from discovery.
</summary>
</member>
<member name="F:Discord.MessageType.GuildDiscoveryRequalified">
<summary>
The message for when a guild is requalified for discovery.
</summary>
</member>
<member name="F:Discord.MessageType.GuildDiscoveryGracePeriodInitialWarning">
<summary>
The message for when the initial warning is sent for the initial grace period discovery.
</summary>
</member>
<member name="F:Discord.MessageType.GuildDiscoveryGracePeriodFinalWarning">
<summary>
The message for when the final warning is sent for the initial grace period discovery.
</summary>
</member>
<member name="F:Discord.MessageType.ThreadCreated">
<summary>
The message for when a thread is created.
</summary>
</member>
<member name="F:Discord.MessageType.Reply">
<summary>
The message is an inline reply.
</summary>
<remarks>
Only available in API v8
</remarks>
</member>
<member name="F:Discord.MessageType.ApplicationCommand">
<summary>
@@ -7567,6 +7623,19 @@
Only available in API v8
</remarks>
</member>
<member name="F:Discord.MessageType.ThreadStarterMessage">
<summary>
The message that starts a thread.
</summary>
<remarks>
Only available in API v9
</remarks>
</member>
<member name="F:Discord.MessageType.GuildInviteReminder">
<summary>
The message for a invite reminder
</summary>
</member>
<member name="T:Discord.ReactionMetadata">
<summary>
A metadata containing reaction information.


+ 8
- 0
src/Discord.Net.Core/Entities/Guilds/IGuild.cs View File

@@ -316,6 +316,14 @@ namespace Discord
/// </returns>
string PreferredLocale { get; }

/// <summary>
/// Gets the NSFW level of this guild.
/// </summary>
/// <returns>
/// The NSFW level of this guild.
/// </returns>
NsfwLevel NsfwLevel { get; }

/// <summary>
/// Gets the preferred culture of this guild.
/// </summary>


+ 22
- 0
src/Discord.Net.Core/Entities/Guilds/NsfwLevel.cs View File

@@ -0,0 +1,22 @@
namespace Discord
{
public enum NsfwLevel
{
/// <summary>
/// Default or unset.
/// </summary>
Default = 0,
/// <summary>
/// Guild has extremely suggestive or mature content that would only be suitable for users 18 or over.
/// </summary>
Explicit = 1,
/// <summary>
/// Guild has no content that could be deemed NSFW; in other words, SFW.
/// </summary>
Safe = 2,
/// <summary>
/// Guild has mildly NSFW content that may not be suitable for users under 18.
/// </summary>
AgeRestricted = 3
}
}

+ 2
- 0
src/Discord.Net.Rest/API/Common/Guild.cs View File

@@ -78,5 +78,7 @@ namespace Discord.API
public Optional<int> ApproximatePresenceCount { get; set; }
[JsonProperty("threads")]
public Optional<Channel[]> Threads { get; set; }
[JsonProperty("nsfw_level")]
public NsfwLevel NsfwLevel { get; set; }
}
}

+ 3
- 0
src/Discord.Net.Rest/Discord.Net.Rest.xml View File

@@ -2896,6 +2896,9 @@
<member name="P:Discord.Rest.RestGuild.ApproximatePresenceCount">
<inheritdoc />
</member>
<member name="P:Discord.Rest.RestGuild.NsfwLevel">
<inheritdoc />
</member>
<member name="P:Discord.Rest.RestGuild.PreferredCulture">
<inheritdoc />
</member>


+ 3
- 0
src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs View File

@@ -83,6 +83,8 @@ namespace Discord.Rest
public int? ApproximateMemberCount { get; private set; }
/// <inheritdoc />
public int? ApproximatePresenceCount { get; private set; }
/// <inheritdoc />
public NsfwLevel NsfwLevel { get; private set; }

/// <inheritdoc />
public CultureInfo PreferredCulture { get; private set; }
@@ -151,6 +153,7 @@ namespace Discord.Rest
SystemChannelFlags = model.SystemChannelFlags;
Description = model.Description;
PremiumSubscriptionCount = model.PremiumSubscriptionCount.GetValueOrDefault();
NsfwLevel = model.NsfwLevel;
if (model.MaxPresences.IsSpecified)
MaxPresences = model.MaxPresences.Value ?? 25000;
if (model.MaxMembers.IsSpecified)


+ 12
- 7
src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml View File

@@ -2787,6 +2787,9 @@
<member name="P:Discord.WebSocket.SocketGuild.MaxVideoChannelUsers">
<inheritdoc />
</member>
<member name="P:Discord.WebSocket.SocketGuild.NsfwLevel">
<inheritdoc />
</member>
<member name="P:Discord.WebSocket.SocketGuild.PreferredCulture">
<inheritdoc />
</member>
@@ -3492,7 +3495,7 @@
The message that contained the trigger for this interaction.
</summary>
</member>
<member name="M:Discord.WebSocket.SocketMessageComponent.RespondAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)">
<member name="M:Discord.WebSocket.SocketMessageComponent.RespondAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed)">
<inheritdoc/>
</member>
<member name="M:Discord.WebSocket.SocketMessageComponent.UpdateAsync(System.Action{Discord.MessageProperties},Discord.RequestOptions)">
@@ -3503,7 +3506,7 @@
<param name="options">The request options for this async request.</param>
<returns>A task that represents the asynchronous operation of updating the message.</returns>
</member>
<member name="M:Discord.WebSocket.SocketMessageComponent.FollowupAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)">
<member name="M:Discord.WebSocket.SocketMessageComponent.FollowupAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed)">
<inheritdoc/>
</member>
<member name="M:Discord.WebSocket.SocketMessageComponent.DeferAsync(Discord.RequestOptions)">
@@ -3619,10 +3622,10 @@
The data associated with this interaction.
</summary>
</member>
<member name="M:Discord.WebSocket.SocketSlashCommand.RespondAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)">
<member name="M:Discord.WebSocket.SocketSlashCommand.RespondAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed)">
<inheritdoc/>
</member>
<member name="M:Discord.WebSocket.SocketSlashCommand.FollowupAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)">
<member name="M:Discord.WebSocket.SocketSlashCommand.FollowupAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed)">
<inheritdoc/>
</member>
<member name="M:Discord.WebSocket.SocketSlashCommand.DeferAsync(Discord.RequestOptions)">
@@ -3708,12 +3711,12 @@
<see langword="true"/> if the token is valid for replying to, otherwise <see langword="false"/>.
</summary>
</member>
<member name="M:Discord.WebSocket.SocketInteraction.RespondAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)">
<member name="M:Discord.WebSocket.SocketInteraction.RespondAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed)">
<summary>
Responds to an Interaction with type <see cref="F:Discord.InteractionResponseType.ChannelMessageWithSource"/>.
<para>
If you have <see cref="P:Discord.WebSocket.DiscordSocketConfig.AlwaysAcknowledgeInteractions"/> set to <see langword="true"/>, You should use
<see cref="!:FollowupAsync(Discord.Embed[],string,bool,bool,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)"/> instead.
<see cref="M:Discord.WebSocket.SocketInteraction.FollowupAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed)"/> instead.
</para>
</summary>
<param name="text">The text of the message to be sent.</param>
@@ -3723,10 +3726,11 @@
<param name="allowedMentions">The allowed mentions for this response.</param>
<param name="options">The request options for this response.</param>
<param name="component">A <see cref="T:Discord.MessageComponent"/> to be sent with this response</param>
<param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
<exception cref="T:System.ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.</exception>
<exception cref="T:System.InvalidOperationException">The parameters provided were invalid or the token was invalid.</exception>
</member>
<member name="M:Discord.WebSocket.SocketInteraction.FollowupAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)">
<member name="M:Discord.WebSocket.SocketInteraction.FollowupAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed)">
<summary>
Sends a followup message for this interaction.
</summary>
@@ -3737,6 +3741,7 @@
<param name="allowedMentions">The allowed mentions for this response.</param>
<param name="options">The request options for this response.</param>
<param name="component">A <see cref="T:Discord.MessageComponent"/> to be sent with this response</param>
<param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
<returns>
The sent message.
</returns>


+ 3
- 0
src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs View File

@@ -118,6 +118,8 @@ namespace Discord.WebSocket
public int? MaxMembers { get; private set; }
/// <inheritdoc />
public int? MaxVideoChannelUsers { get; private set; }
/// <inheritdoc />
public NsfwLevel NsfwLevel { get; private set; }

/// <inheritdoc />
public CultureInfo PreferredCulture { get; private set; }
@@ -464,6 +466,7 @@ namespace Discord.WebSocket
SystemChannelFlags = model.SystemChannelFlags;
Description = model.Description;
PremiumSubscriptionCount = model.PremiumSubscriptionCount.GetValueOrDefault();
NsfwLevel = model.NsfwLevel;
if (model.MaxPresences.IsSpecified)
MaxPresences = model.MaxPresences.Value ?? 25000;
if (model.MaxMembers.IsSpecified)


Loading…
Cancel
Save