From 4649220bc2846c8fbc25ebfb18fa33b32bfd597d Mon Sep 17 00:00:00 2001 From: Chris Johnston Date: Tue, 4 Jun 2019 21:36:34 -0700 Subject: [PATCH] add extension methods that make it easier to check the SystemChannelMessage flags for end users because the flag is inverted, this ideally should make it easier for the user. it may also be useful to do something similar for modifying this property --- .../Extensions/GuildExtensions.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/Discord.Net.Core/Extensions/GuildExtensions.cs diff --git a/src/Discord.Net.Core/Extensions/GuildExtensions.cs b/src/Discord.Net.Core/Extensions/GuildExtensions.cs new file mode 100644 index 000000000..b3c52920c --- /dev/null +++ b/src/Discord.Net.Core/Extensions/GuildExtensions.cs @@ -0,0 +1,24 @@ +namespace Discord +{ + /// + /// An extension class for . + /// + public static class GuildExtensions + { + /// + /// Gets if welcome message system messages are enabled. + /// + /// The guild to check. + /// A bool indicating if the welcome messages are enabled in the system channel. + public static bool GetWelcomeMessagesEnabled(this IGuild guild) + => !guild.SystemChannelFlags.HasFlag(SystemChannelMessageDeny.WelcomeMessage); + + /// + /// Gets if guild boost system messages are enabled. + /// + /// The guild to check. + /// A bool indicating if the guild boost messages are enabled in the system channel. + public static bool GetGuildBoostMessagesEnabled(this IGuild guild) + => !guild.SystemChannelFlags.HasFlag(SystemChannelMessageDeny.GuildBoost); + } +}