浏览代码

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
pull/1319/head
Chris Johnston 7 年前
父节点
当前提交
4649220bc2
共有 1 个文件被更改,包括 24 次插入0 次删除
  1. +24
    -0
      src/Discord.Net.Core/Extensions/GuildExtensions.cs

+ 24
- 0
src/Discord.Net.Core/Extensions/GuildExtensions.cs 查看文件

@@ -0,0 +1,24 @@
namespace Discord
{
/// <summary>
/// An extension class for <see cref="IGuild"/>.
/// </summary>
public static class GuildExtensions
{
/// <summary>
/// Gets if welcome message system messages are enabled.
/// </summary>
/// <param name="guild"> The guild to check. </param>
/// <returns> A <c>bool</c> indicating if the welcome messages are enabled in the system channel. </returns>
public static bool GetWelcomeMessagesEnabled(this IGuild guild)
=> !guild.SystemChannelFlags.HasFlag(SystemChannelMessageDeny.WelcomeMessage);

/// <summary>
/// Gets if guild boost system messages are enabled.
/// </summary>
/// <param name="guild"> The guild to check. </param>
/// <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);
}
}

正在加载...
取消
保存