Add selector descriptions

This commit is contained in:
Toastie 2024-12-26 23:25:11 +13:00
parent 414ace3dcc
commit 14724c054e
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4

View file

@ -15,7 +15,6 @@ namespace SupportChild;
public static class Interviewer
{
// TODO: Validate that the different types have the appropriate amount of subpaths
public enum QuestionType
{
// Support multiselector as separate type, with only one subpath supported
@ -46,8 +45,6 @@ public static class Interviewer
// The entire interview tree is serialized and stored in the database in order to record responses as they are made.
public class InterviewQuestion
{
// TODO: String selector entry description
// Title of the message embed.
[JsonProperty("title")]
public string title;
@ -78,6 +75,10 @@ public static class Interviewer
[JsonProperty("selector-placeholder")]
public string selectorPlaceholder;
// If this question is on a selector, give it this description.
[JsonProperty("selector-description")]
public string selectorDescription;
// The maximum length of a text input.
[JsonProperty("max-length")]
public int maxLength;
@ -230,6 +231,9 @@ public static class Interviewer
[JsonProperty("selector-placeholder", Required = Required.Default)]
public string selectorPlaceholder;
[JsonProperty("selector-description", Required = Required.Default)]
public string selectorDescription;
[JsonProperty("max-length", Required = Required.Default)]
public int maxLength;
@ -725,7 +729,8 @@ public static class Interviewer
List<DiscordSelectComponentOption> categoryOptions = [];
for (; selectionOptions < 25 * (selectionBoxes + 1) && selectionOptions < question.paths.Count; selectionOptions++)
{
categoryOptions.Add(new DiscordSelectComponentOption(question.paths.ToArray()[selectionOptions].Key, selectionOptions.ToString()));
(string questionString, InterviewQuestion nextQuestion) = question.paths.ToArray()[selectionOptions];
categoryOptions.Add(new DiscordSelectComponentOption(questionString, selectionOptions.ToString(), nextQuestion.selectorDescription));
}
selectionComponents.Add(new DiscordSelectComponent("supportchild_interviewselector " + selectionBoxes, string.IsNullOrWhiteSpace(question.selectorPlaceholder)