From dd7db1f5b7cc118671a0ab7a8f9b69dac8968a29 Mon Sep 17 00:00:00 2001 From: Quin Lynch Date: Fri, 27 May 2022 08:19:09 -0300 Subject: [PATCH] rearrange to have voice fall through the switch first --- .../Entities/Permissions/ChannelPermissions.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs b/src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs index 198d18b8b..3c6a804c5 100644 --- a/src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs +++ b/src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs @@ -51,16 +51,11 @@ namespace Discord /// Unknown channel type. public static ChannelPermissions All(IChannel channel) { - // Because IVoiceChannel implements ITextChannel, the switch will allow voice to pass as text. - // - // This check will prevent that and first attempt to cast as voice instead. - if (channel is IVoiceChannel) - return Voice; - return channel switch { - ITextChannel _ => Text, IStageChannel _ => Stage, + IVoiceChannel _ => Voice, + ITextChannel _ => Text, ICategoryChannel _ => Category, IDMChannel _ => DM, IGroupChannel _ => Group,