Browse Source

Add missing flags to SystemChannelMessageDeny (#267)

pull/1923/head
CottageDwellingCat GitHub 3 years ago
parent
commit
650dd94fb3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 3 deletions
  1. +3
    -2
      src/Discord.Net.Core/Entities/Guilds/GuildProperties.cs
  2. +9
    -1
      src/Discord.Net.Core/Entities/Guilds/SystemChannelMessageDeny.cs
  3. +16
    -0
      src/Discord.Net.Core/Extensions/GuildExtensions.cs

+ 3
- 2
src/Discord.Net.Core/Entities/Guilds/GuildProperties.cs View File

@@ -85,8 +85,9 @@ namespace Discord
/// given that the <see cref="SystemChannelId"/> has also been set.
/// A value of <see cref="SystemChannelMessageDeny.GuildBoost"/> will deny guild boost messages from being sent, and allow all
/// other types of messages.
/// Refer to the extension methods <see cref="GuildExtensions.GetGuildBoostMessagesEnabled(IGuild)"/> and
/// <see cref="GuildExtensions.GetWelcomeMessagesEnabled(IGuild)"/> to check if these system channel message types
/// Refer to the extension methods <see cref="GuildExtensions.GetGuildBoostMessagesEnabled(IGuild)"/>,
/// <see cref="GuildExtensions.GetWelcomeMessagesEnabled(IGuild)"/>, <see cref="GuildExtensions.GetGuildSetupTipMessagesEnabled(IGuild)"/>,
/// and <see cref="GuildExtensions.GetGuildWelcomeMessageReplyEnabled(IGuild)"/> to check if these system channel message types
/// are enabled, without the need to manipulate the logic of the flag.
/// </remarks>
public Optional<SystemChannelMessageDeny> SystemChannelFlags { get; set; }


+ 9
- 1
src/Discord.Net.Core/Entities/Guilds/SystemChannelMessageDeny.cs View File

@@ -17,6 +17,14 @@ namespace Discord
/// <summary>
/// Deny the messages that are sent when a user boosts the guild.
/// </summary>
GuildBoost = 0b10
GuildBoost = 0b10,
/// <summary>
/// Deny the messages that are related to guild setup.
/// </summary>
GuildSetupTip = 0b100,
/// <summary>
/// Deny the reply with sticker button on welcome messages.
/// </summary>
WelcomeMessageReply = 0b1000
}
}

+ 16
- 0
src/Discord.Net.Core/Extensions/GuildExtensions.cs View File

@@ -20,5 +20,21 @@ namespace Discord
/// <returns> A <c>bool</c> indicating if the guild boost messages are enabled in the system channel. </returns>
public static bool GetGuildBoostMessagesEnabled(this IGuild guild)
=> !guild.SystemChannelFlags.HasFlag(SystemChannelMessageDeny.GuildBoost);

/// <summary>
/// Gets if guild setup system messages are enabled.
/// </summary>
/// <param name="guild"> The guild to check. </param>
/// <returns> A <c>bool</c> indicating if the guild setup messages are enabled in the system channel. </returns>
public static bool GetGuildSetupTipMessagesEnabled(this IGuild guild)
=> !guild.SystemChannelFlags.HasFlag(SystemChannelMessageDeny.GuildSetupTip);

/// <summary>
/// Gets if guild welcome messages have a reply with sticker button.
/// </summary>
/// <param name="guild"> The guild to check. </param>
/// <returns> A <c>bool</c> indicating if the guild welcome messages have a reply with sticker button. </returns>
public static bool GetGuildWelcomeMessageReplyEnabled(this IGuild guild)
=> !guild.SystemChannelFlags.HasFlag(SystemChannelMessageDeny.WelcomeMessageReply);
}
}

Loading…
Cancel
Save