@@ -57,10 +57,8 @@ namespace Discord.Commands | |||||
if (ChannelPermission.HasValue) | if (ChannelPermission.HasValue) | ||||
{ | { | ||||
var guildChannel = context.Channel as IGuildChannel; | |||||
ChannelPermissions perms; | ChannelPermissions perms; | ||||
if (guildChannel != null) | |||||
if (context.Channel is IGuildChannel guildChannel) | |||||
perms = guildUser.GetPermissions(guildChannel); | perms = guildUser.GetPermissions(guildChannel); | ||||
else | else | ||||
perms = ChannelPermissions.All(context.Channel); | perms = ChannelPermissions.All(context.Channel); | ||||
@@ -56,10 +56,8 @@ namespace Discord.Commands | |||||
if (ChannelPermission.HasValue) | if (ChannelPermission.HasValue) | ||||
{ | { | ||||
var guildChannel = context.Channel as IGuildChannel; | |||||
ChannelPermissions perms; | ChannelPermissions perms; | ||||
if (guildChannel != null) | |||||
if (context.Channel is IGuildChannel guildChannel) | |||||
perms = guildUser.GetPermissions(guildChannel); | perms = guildUser.GetPermissions(guildChannel); | ||||
else | else | ||||
perms = ChannelPermissions.All(context.Channel); | perms = ChannelPermissions.All(context.Channel); | ||||