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

@ -131,24 +131,31 @@ public class GuildRepository(ILogger logger, DatabaseConnection conn)
new { GuildId = guildId.Value, RoleId = roleId.Value }
);
public async Task UpdateChannelConfigAsync(Snowflake id, Guild.ChannelConfig config) =>
public async Task UpdateChannelConfigAsync(Snowflake id, Guild config) =>
await conn.ExecuteAsync(
"update guilds set channels = @Channels::jsonb where id = @Id",
new { Id = id.Value, Channels = config }
"update guilds set channels = @Channels::jsonb, messages = @Messages::jsonb where id = @Id",
new
{
Id = id.Value,
config.Channels,
config.Messages,
}
);
public async Task ImportConfigAsync(
ulong id,
Guild.ChannelConfig channels,
Guild.MessageConfig messages,
string[] bannedSystems,
ulong[] keyRoles
) =>
await conn.ExecuteAsync(
"update guilds set channels = @channels::jsonb, banned_systems = @bannedSystems, key_roles = @keyRoles where id = @id",
"update guilds set channels = @channels::jsonb, messages = @messages::jsonb, banned_systems = @bannedSystems, key_roles = @keyRoles where id = @id",
new
{
id,
channels,
messages,
bannedSystems,
keyRoles,
}