Made registering a category no longer be a requirement for uploading a template for it

This commit is contained in:
Toastie 2024-12-27 16:28:27 +13:00
parent 22dc2255bc
commit d4be9cb849
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
5 changed files with 4 additions and 34 deletions

View file

@ -18,7 +18,7 @@ public class CreateButtonPanelCommand
public async Task OnExecute(SlashCommandContext command)
{
DiscordMessageBuilder builder = new DiscordMessageBuilder().WithContent(" ");
List<Database.Category> verifiedCategories = await Utilities.GetVerifiedChannels();
List<Database.Category> verifiedCategories = await Utilities.GetVerifiedCategories();
if (verifiedCategories.Count == 0)
{

View file

@ -46,7 +46,7 @@ public class CreateSelectionBoxPanelCommand
public static async Task<List<DiscordSelectComponent>> GetSelectComponents(SlashCommandContext command, string placeholder)
{
List<Database.Category> verifiedCategories = await Utilities.GetVerifiedChannels();
List<Database.Category> verifiedCategories = await Utilities.GetVerifiedCategories();
if (verifiedCategories.Count == 0)
{

View file

@ -38,16 +38,6 @@ public class InterviewTemplateCommands
return;
}
if (!Database.TryGetCategory(category.Id, out Database.Category _))
{
await command.RespondAsync(new DiscordEmbedBuilder
{
Color = DiscordColor.Red,
Description = "That category is not registered with the bot."
}, true);
return;
}
string interviewTemplateJSON = Database.GetInterviewTemplateJSON(category.Id);
if (interviewTemplateJSON == null)
{
@ -123,16 +113,6 @@ public class InterviewTemplateCommands
return;
}
if (!Database.TryGetCategory(category.Id, out Database.Category _))
{
await command.RespondAsync(new DiscordEmbedBuilder
{
Color = DiscordColor.Red,
Description = "The category ID in the uploaded JSON structure is not a category registered with the bot, use /addcategory first."
}, true);
return;
}
List<string> errors = [];
List<string> warnings = [];
template.interview.Validate(ref errors, ref warnings, "interview", 0, 0);
@ -234,16 +214,6 @@ public class InterviewTemplateCommands
return;
}
if (!Database.TryGetCategory(category.Id, out Database.Category _))
{
await command.RespondAsync(new DiscordEmbedBuilder
{
Color = DiscordColor.Red,
Description = "That category is not registered with the bot."
}, true);
return;
}
if (!Database.TryGetInterviewTemplate(category.Id, out InterviewQuestion _))
{
await command.RespondAsync(new DiscordEmbedBuilder

View file

@ -19,7 +19,7 @@ public class NewCommand
[Description("Opens a new ticket.")]
public async Task OnExecute(SlashCommandContext command)
{
List<Database.Category> verifiedCategories = await Utilities.GetVerifiedChannels();
List<Database.Category> verifiedCategories = await Utilities.GetVerifiedCategories();
switch (verifiedCategories.Count)
{
case 0:

View file

@ -54,7 +54,7 @@ public static class Utilities
return messages;
}
public static async Task<List<Database.Category>> GetVerifiedChannels()
public static async Task<List<Database.Category>> GetVerifiedCategories()
{
List<Database.Category> verifiedCategories = new List<Database.Category>();
foreach (Database.Category category in Database.GetAllCategories())