feat: invite management commands

This commit is contained in:
sam 2024-10-14 00:26:17 +02:00
parent 32732d74d0
commit 5a2bd7388c
6 changed files with 310 additions and 13 deletions

View file

@ -36,8 +36,9 @@ public class KeyRoleCommands(
var guildConfig = await db.GetGuildAsync(guildId);
if (guildConfig.KeyRoles.Count == 0)
return await feedbackService.SendContextualAsync(
"There are no key roles to list. Add some with `/key-roles add`."
return await feedbackService.ReplyAsync(
"There are no key roles to list. Add some with `/key-roles add`.",
isEphemeral: true
);
var description = string.Join(
@ -71,15 +72,16 @@ public class KeyRoleCommands(
var guildConfig = await db.GetGuildAsync(guildId);
if (guildConfig.KeyRoles.Any(id => role.ID == id))
return await feedbackService.SendContextualAsync($"{role.Name} is already a key role.");
return await feedbackService.ReplyAsync(
$"{role.Name} is already a key role.",
isEphemeral: true
);
guildConfig.KeyRoles.Add(role.ID.Value);
db.Update(guildConfig);
await db.SaveChangesAsync();
return await feedbackService.SendContextualAsync(
$"Added {role.Name} to this server's key roles!"
);
return await feedbackService.ReplyAsync($"Added {role.Name} to this server's key roles!");
}
[Command("remove")]
@ -95,15 +97,16 @@ public class KeyRoleCommands(
var guildConfig = await db.GetGuildAsync(guildId);
if (guildConfig.KeyRoles.All(id => role.ID != id))
return await feedbackService.SendContextualAsync(
$"{role.Name} is already not a key role."
return await feedbackService.ReplyAsync(
$"{role.Name} is already not a key role.",
isEphemeral: true
);
guildConfig.KeyRoles.Remove(role.ID.Value);
db.Update(guildConfig);
await db.SaveChangesAsync();
return await feedbackService.SendContextualAsync(
return await feedbackService.ReplyAsync(
$"Removed {role.Name} from this server's key roles!"
);
}