fix: actually store ignored channels/roles

This commit is contained in:
sam 2024-11-18 20:47:58 +01:00
parent 19d9f33454
commit e12bd6194b
Signed by: sam
GPG key ID: 5F3C3C1B3166639D
12 changed files with 37 additions and 25 deletions

View file

@ -131,14 +131,22 @@ public class GuildRepository(ILogger logger, DatabaseConnection conn)
new { GuildId = guildId.Value, RoleId = roleId.Value }
);
public async Task UpdateChannelConfigAsync(Snowflake id, Guild config) =>
public async Task UpdateConfigAsync(Snowflake id, Guild config) =>
await conn.ExecuteAsync(
"update guilds set channels = @Channels::jsonb, messages = @Messages::jsonb where id = @Id",
"""
update guilds set channels = @Channels::jsonb,
messages = @Messages::jsonb,
ignored_channels = @IgnoredChannels,
ignored_roles = @IgnoredRoles
where id = @Id
""",
new
{
Id = id.Value,
config.Channels,
config.Messages,
config.IgnoredChannels,
config.IgnoredRoles,
}
);