diff --git a/PluralKit.Bot/Commands/ServerConfig.cs b/PluralKit.Bot/Commands/ServerConfig.cs index 77af6bac..a33d39d3 100644 --- a/PluralKit.Bot/Commands/ServerConfig.cs +++ b/PluralKit.Bot/Commands/ServerConfig.cs @@ -204,7 +204,8 @@ public class ServerConfig var affectedChannels = new List(); if (ctx.Match("all")) affectedChannels = (await _cache.GetGuildChannels(ctx.Guild.Id)) - .Where(x => x.Type == Channel.ChannelType.GuildText).ToList(); + // All the channel types you can proxy in + .Where(x => DiscordUtils.IsValidGuildChannel(x)).ToList(); else if (!ctx.HasNext()) throw new PKSyntaxError("You must pass one or more #channels."); else while (ctx.HasNext()) diff --git a/PluralKit.Bot/Proxy/ProxyService.cs b/PluralKit.Bot/Proxy/ProxyService.cs index aae862ce..5bfe7c06 100644 --- a/PluralKit.Bot/Proxy/ProxyService.cs +++ b/PluralKit.Bot/Proxy/ProxyService.cs @@ -111,31 +111,10 @@ public class ProxyService return true; } -#pragma warning disable CA1822 // Mark members as static - internal bool CanProxyInChannel(Channel ch, bool isRootChannel = false) -#pragma warning restore CA1822 // Mark members as static - { - // this is explicitly selecting known channel types so that when Discord add new - // ones, users don't get flooded with error codes if that new channel type doesn't - // support a feature we need for proxying - return ch.Type switch - { - Channel.ChannelType.GuildText => true, - Channel.ChannelType.GuildPublicThread => true, - Channel.ChannelType.GuildPrivateThread => true, - Channel.ChannelType.GuildNews => true, - Channel.ChannelType.GuildNewsThread => true, - Channel.ChannelType.GuildVoice => true, - Channel.ChannelType.GuildStageVoice => true, - Channel.ChannelType.GuildForum => isRootChannel, - Channel.ChannelType.GuildMedia => isRootChannel, - _ => false, - }; - } - + // Proxy checks that give user errors public async Task CanProxy(Channel channel, Channel rootChannel, Message msg, MessageContext ctx) { - if (!(CanProxyInChannel(channel) && CanProxyInChannel(rootChannel, true))) + if (DiscordUtils.IsValidGuildChannel(channel)) return $"PluralKit cannot proxy messages in this type of channel."; // Check if the message does not go over any Discord Nitro limits @@ -159,6 +138,7 @@ public class ProxyService return null; } + // Proxy checks that don't give user errors unless `pk;debug proxy` is used public bool ShouldProxy(Channel channel, Channel rootChannel, Message msg, MessageContext ctx) { // Make sure author has a system