feat: split ignores into 'ignore messages' and 'ignore entities'
This commit is contained in:
parent
d48ab7e16e
commit
0cac964aa6
32 changed files with 730 additions and 488 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue