fix: dapper doesn't play nice with List<T>

This commit is contained in:
sam 2024-10-27 23:43:07 +01:00
parent 64b4c26d93
commit da4dfae27c
Signed by: sam
GPG key ID: 5F3C3C1B3166639D
4 changed files with 31 additions and 6 deletions

View file

@ -50,7 +50,7 @@ public class KeyRoleCommands(
var guildRoles = roleCache.GuildRoles(guildId).ToList();
var guildConfig = await db.GetGuildAsync(guildId);
if (guildConfig.KeyRoles.Count == 0)
if (guildConfig.KeyRoles.Length == 0)
return await feedbackService.ReplyAsync(
"There are no key roles to list. Add some with `/key-roles add`.",
isEphemeral: true
@ -92,7 +92,7 @@ public class KeyRoleCommands(
isEphemeral: true
);
guildConfig.KeyRoles.Add(role.ID.Value);
guildConfig.KeyRoles = guildConfig.KeyRoles.Append(role.ID.Value).ToArray();
db.Update(guildConfig);
await db.SaveChangesAsync();
@ -117,7 +117,7 @@ public class KeyRoleCommands(
isEphemeral: true
);
guildConfig.KeyRoles.Remove(role.ID.Value);
guildConfig.KeyRoles = guildConfig.KeyRoles.Except([role.ID.Value]).ToArray();
db.Update(guildConfig);
await db.SaveChangesAsync();