fix: let you blacklist any channel you can proxy in

This commit is contained in:
rladenson 2024-10-03 01:16:52 -06:00
parent debfc46776
commit 35489260e4
2 changed files with 13 additions and 1 deletions

View file

@ -204,7 +204,17 @@ public class ServerConfig
var affectedChannels = new List<Channel>();
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. Taken from ProxyService
.Where(x => x.Type == Channel.ChannelType.GuildText
|| x.Type == Channel.ChannelType.GuildPublicThread
|| x.Type == Channel.ChannelType.GuildPrivateThread
|| x.Type == Channel.ChannelType.GuildNews
|| x.Type == Channel.ChannelType.GuildNewsThread
|| x.Type == Channel.ChannelType.GuildVoice
|| x.Type == Channel.ChannelType.GuildStageVoice
|| x.Type == Channel.ChannelType.GuildForum
|| x.Type == Channel.ChannelType.GuildMedia
).ToList();
else if (!ctx.HasNext()) throw new PKSyntaxError("You must pass one or more #channels.");
else
while (ctx.HasNext())

View file

@ -118,6 +118,8 @@ public class ProxyService
// 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
// Note: If you add new channels to this, also add them to the allowed channel types
// for blacklisting
return ch.Type switch
{
Channel.ChannelType.GuildText => true,