feat: split ignores into 'ignore messages' and 'ignore entities'

This commit is contained in:
sam 2024-11-18 00:47:27 +01:00
parent d48ab7e16e
commit 0cac964aa6
Signed by: sam
GPG key ID: 5F3C3C1B3166639D
32 changed files with 730 additions and 488 deletions

View file

@ -159,28 +159,6 @@ public partial class GuildsController(
.ToList();
var guildConfig = await guildRepository.GetAsync(guildId);
if (req.IgnoredChannels != null)
{
var categories = channelCache
.GuildChannels(guildId)
.Where(c => c.Type is ChannelType.GuildCategory)
.ToList();
if (
req.IgnoredChannels.Any(cId =>
guildChannels.All(c => c.ID.Value != cId)
&& categories.All(c => c.ID.Value != cId)
)
)
throw new ApiError(
HttpStatusCode.BadRequest,
ErrorCode.BadRequest,
"One or more ignored channels are unknown"
);
guildConfig.Channels.IgnoredChannels = req.IgnoredChannels.ToList();
}
// i love repeating myself wheeeeee
if (
req.GuildUpdate == null
@ -334,12 +312,11 @@ public partial class GuildsController(
)
guildConfig.Channels.MessageDeleteBulk = req.MessageDeleteBulk ?? 0;
await guildRepository.UpdateChannelConfigAsync(guildId, guildConfig.Channels);
await guildRepository.UpdateChannelConfigAsync(guildId, guildConfig);
return Ok(guildConfig.Channels);
}
public record ChannelRequest(
ulong[]? IgnoredChannels = null,
ulong? GuildUpdate = null,
ulong? GuildEmojisUpdate = null,
ulong? GuildRoleCreate = null,