diff --git a/src/Kook.Net.Core/Entities/Permissions/GuildPermissions.cs b/src/Kook.Net.Core/Entities/Permissions/GuildPermissions.cs index 8e6d602a..4da14a06 100644 --- a/src/Kook.Net.Core/Entities/Permissions/GuildPermissions.cs +++ b/src/Kook.Net.Core/Entities/Permissions/GuildPermissions.cs @@ -169,7 +169,7 @@ public struct GuildPermissions public bool ShareScreen => Permissions.GetValue(RawValue, GuildPermission.ShareScreen); /// - /// 获取此权限集是否允许相关用户发布t帖子回复。 + /// 获取此权限集是否允许相关用户发布帖子回复。 /// public bool ReplyToPost => Permissions.GetValue(RawValue, GuildPermission.ReplyToPost); diff --git a/src/Kook.Net.Core/Entities/Permissions/OverwritePermissions.cs b/src/Kook.Net.Core/Entities/Permissions/OverwritePermissions.cs index 7ee0655d..e1d41a4b 100644 --- a/src/Kook.Net.Core/Entities/Permissions/OverwritePermissions.cs +++ b/src/Kook.Net.Core/Entities/Permissions/OverwritePermissions.cs @@ -127,6 +127,11 @@ public static OverwritePermissions DenyAll(IChannel channel) => /// public PermValue ShareScreen => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.ShareScreen); + /// + /// 获取此权限重写配置对频道权限位 的重写配置。 + /// + public PermValue ReplyToPost => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.ReplyToPost); + /// /// 使用指定的原始值初始化一个 结构的新实例。 /// @@ -156,7 +161,8 @@ private OverwritePermissions(ulong allowValue, ulong denyValue, PermValue? deafenMembers = null, PermValue? muteMembers = null, PermValue? playSoundtrack = null, - PermValue? shareScreen = null) + PermValue? shareScreen = null, + PermValue? replyToPost = null) { Permissions.SetValue(ref allowValue, ref denyValue, createInvites, ChannelPermission.CreateInvites); Permissions.SetValue(ref allowValue, ref denyValue, manageChannels, ChannelPermission.ManageChannels); @@ -176,6 +182,7 @@ private OverwritePermissions(ulong allowValue, ulong denyValue, Permissions.SetValue(ref allowValue, ref denyValue, muteMembers, ChannelPermission.MuteMembers); Permissions.SetValue(ref allowValue, ref denyValue, playSoundtrack, ChannelPermission.PlaySoundtrack); Permissions.SetValue(ref allowValue, ref denyValue, shareScreen, ChannelPermission.ShareScreen); + Permissions.SetValue(ref allowValue, ref denyValue, replyToPost, ChannelPermission.ReplyToPost); AllowValue = allowValue; DenyValue = denyValue; @@ -202,6 +209,7 @@ private OverwritePermissions(ulong allowValue, ulong denyValue, /// 服务器闭麦。 /// 共享计算机音频。 /// 屏幕分享。 + /// 发布帖子回复。 public OverwritePermissions( PermValue createInvites = PermValue.Inherit, PermValue manageChannels = PermValue.Inherit, @@ -220,10 +228,11 @@ public OverwritePermissions( PermValue deafenMembers = PermValue.Inherit, PermValue muteMembers = PermValue.Inherit, PermValue playSoundtrack = PermValue.Inherit, - PermValue shareScreen = PermValue.Inherit) + PermValue shareScreen = PermValue.Inherit, + PermValue replyToPost = PermValue.Inherit) : this(0, 0, createInvites, manageChannels, manageRoles, viewChannel, sendMessages, manageMessages, attachFiles, connect, manageVoice, mentionEveryone, addReactions, passiveConnect, useVoiceActivity, speak, - deafenMembers, muteMembers, playSoundtrack, shareScreen) + deafenMembers, muteMembers, playSoundtrack, shareScreen, replyToPost) { } @@ -248,6 +257,7 @@ public OverwritePermissions( /// 服务器闭麦。 /// 共享计算机音频。 /// 屏幕分享。 + /// 发布帖子回复。 /// 更改了指定权限的新的权限集。 public OverwritePermissions Modify( PermValue? createInvites = null, @@ -267,10 +277,11 @@ public OverwritePermissions Modify( PermValue? deafenMembers = null, PermValue? muteMembers = null, PermValue? playSoundtrack = null, - PermValue? shareScreen = null) => - new(AllowValue, DenyValue, createInvites, manageChannels, manageRoles, viewChannel, - sendMessages, manageMessages, attachFiles, connect, manageVoice, mentionEveryone, addReactions, - passiveConnect, useVoiceActivity, speak, deafenMembers, muteMembers, playSoundtrack, shareScreen); + PermValue? shareScreen = null, + PermValue? replyToPost = null) => + new(AllowValue, DenyValue, createInvites, manageChannels, manageRoles, viewChannel, sendMessages, + manageMessages, attachFiles, connect, manageVoice, mentionEveryone, addReactions, passiveConnect, + useVoiceActivity, speak, deafenMembers, muteMembers, playSoundtrack, shareScreen, replyToPost); /// /// 获取一个包含当前权限重写配置所包含的所有重写允许的 独立位标志枚举值的集合。 diff --git a/test/Kook.Net.Tests.Unit/GuildPermissionsTests.cs b/test/Kook.Net.Tests.Unit/GuildPermissionsTests.cs index b6aef48f..513bd70d 100644 --- a/test/Kook.Net.Tests.Unit/GuildPermissionsTests.cs +++ b/test/Kook.Net.Tests.Unit/GuildPermissionsTests.cs @@ -45,7 +45,7 @@ IEnumerable GetTestValues() /// /// Tests the behavior of the constructor for each - /// of it's flags. + /// of its flags. /// [Fact] public void FlagsConstructor() @@ -89,10 +89,12 @@ void AssertFlag(Func cstr, GuildPermission flag) AssertFlag(() => new GuildPermissions(manageNicknames: true), GuildPermission.ManageNicknames); AssertFlag(() => new GuildPermissions(playSoundtrack: true), GuildPermission.PlaySoundtrack); AssertFlag(() => new GuildPermissions(shareScreen: true), GuildPermission.ShareScreen); + AssertFlag(() => new GuildPermissions(replyToPost: true), GuildPermission.ReplyToPost); } /// - /// Tests the behavior of + /// Tests the behavior of + /// /// with each of the parameters. /// [Fact] @@ -160,5 +162,6 @@ void AssertUtil(GuildPermission permission, AssertUtil(GuildPermission.ManageNicknames, x => x.ManageNicknames, (p, enable) => p.Modify(manageNicknames: enable)); AssertUtil(GuildPermission.PlaySoundtrack, x => x.PlaySoundtrack, (p, enable) => p.Modify(playSoundtrack: enable)); AssertUtil(GuildPermission.ShareScreen, x => x.ShareScreen, (p, enable) => p.Modify(shareScreen: enable)); + AssertUtil(GuildPermission.ReplyToPost, x => x.ReplyToPost, (p, enable) => p.Modify(replyToPost: enable)); } }