From e627f0780a74e9f2c2c1b497aa5bcf31d2ab79f6 Mon Sep 17 00:00:00 2001 From: Chris Johnston Date: Fri, 29 Nov 2019 19:07:43 -0800 Subject: [PATCH] change: fix #1415 Re-add support for overwrite permissions for news channels (#1417) This change updates the NewsChannel classes so that the overwrite permission-related properties no longer throw an Exception when they are used. These properties were not initially supported by News/Announcement channels when the feature was first released, but now they are. --- .../Entities/Channels/RestNewsChannel.cs | 24 --------- .../Entities/Channels/SocketNewsChannel.cs | 50 +------------------ 2 files changed, 1 insertion(+), 73 deletions(-) diff --git a/src/Discord.Net.Rest/Entities/Channels/RestNewsChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestNewsChannel.cs index f4984a0d2..8a334fae5 100644 --- a/src/Discord.Net.Rest/Entities/Channels/RestNewsChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/RestNewsChannel.cs @@ -25,29 +25,5 @@ namespace Discord.Rest return entity; } public override int SlowModeInterval => throw new NotSupportedException("News channels do not support Slow Mode."); - public override Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null) - { - throw new NotSupportedException("News channels do not support Overwrite Permissions."); - } - public override Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null) - { - throw new NotSupportedException("News channels do not support Overwrite Permissions."); - } - public override OverwritePermissions? GetPermissionOverwrite(IRole role) - { - throw new NotSupportedException("News channels do not support Overwrite Permissions."); - } - public override OverwritePermissions? GetPermissionOverwrite(IUser user) - { - throw new NotSupportedException("News channels do not support Overwrite Permissions."); - } - public override Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null) - { - throw new NotSupportedException("News channels do not support Overwrite Permissions."); - } - public override Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null) - { - throw new NotSupportedException("News channels do not support Overwrite Permissions."); - } } } diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs index f84c35cae..815a99ce7 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs @@ -11,7 +11,7 @@ namespace Discord.WebSocket /// /// /// - /// Most of the properties and methods featured may not be supported due to the nature of the channel. + /// The property is not supported for news channels. /// /// [DebuggerDisplay(@"{DebuggerDisplay,nq}")] @@ -35,53 +35,5 @@ namespace Discord.WebSocket /// public override int SlowModeInterval => throw new NotSupportedException("News channels do not support Slow Mode."); - /// - /// - /// - /// This method is not supported by this type. Attempting to use this method will result in a . - /// - /// - public override Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null) - => throw new NotSupportedException("News channels do not support Overwrite Permissions."); - /// - /// - /// - /// This method is not supported by this type. Attempting to use this method will result in a . - /// - /// - public override Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null) - => throw new NotSupportedException("News channels do not support Overwrite Permissions."); - /// - /// - /// - /// This property is not supported by this type. Attempting to use this property will result in a . - /// - /// - public override IReadOnlyCollection PermissionOverwrites - => throw new NotSupportedException("News channels do not support Overwrite Permissions."); - /// - /// - /// - /// This method is not supported by this type. Attempting to use this method will result in a . - /// - /// - public override Task SyncPermissionsAsync(RequestOptions options = null) - => throw new NotSupportedException("News channels do not support Overwrite Permissions."); - /// - /// - /// - /// This method is not supported by this type. Attempting to use this method will result in a . - /// - /// - public override Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null) - => throw new NotSupportedException("News channels do not support Overwrite Permissions."); - /// - /// - /// - /// This method is not supported by this type. Attempting to use this method will result in a . - /// - /// - public override Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null) - => throw new NotSupportedException("News channels do not support Overwrite Permissions."); } }