refactor: change ulong[] to List<ulong> for better ergonomics

This commit is contained in:
sam 2024-11-18 21:01:52 +01:00
parent e12bd6194b
commit 4eb5c16451
Signed by: sam
GPG key ID: 5F3C3C1B3166639D
8 changed files with 37 additions and 46 deletions

View file

@ -49,7 +49,7 @@ public class KeyRoleCommands(
var guildRoles = roleCache.GuildRoles(guildId).ToList();
var guildConfig = await guildRepository.GetAsync(guildId);
if (guildConfig.KeyRoles.Length == 0)
if (guildConfig.KeyRoles.Count == 0)
return await feedbackService.ReplyAsync(
"There are no key roles to list. Add some with `/key-roles add`.",
isEphemeral: true
@ -94,7 +94,8 @@ public class KeyRoleCommands(
isEphemeral: true
);
await guildRepository.AddKeyRoleAsync(guildId, role.ID);
guildConfig.KeyRoles.Add(role.ID.Value);
await guildRepository.UpdateConfigAsync(guildId, guildConfig);
return await feedbackService.ReplyAsync($"Added {role.Name} to this server's key roles!");
}
@ -119,7 +120,8 @@ public class KeyRoleCommands(
isEphemeral: true
);
await guildRepository.RemoveKeyRoleAsync(guildId, role.ID);
guildConfig.KeyRoles.Remove(role.ID.Value);
await guildRepository.UpdateConfigAsync(guildId, guildConfig);
return await feedbackService.ReplyAsync(
$"Removed {role.Name} from this server's key roles!"
);