Added selector placeholders to template
This commit is contained in:
parent
f03473ba14
commit
2553ad5c69
1 changed files with 22 additions and 8 deletions
|
@ -46,7 +46,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: Add selector placeholder
|
||||
// Title of the message embed.
|
||||
[JsonProperty("title")]
|
||||
public string title;
|
||||
|
@ -73,9 +72,15 @@ public static class Interviewer
|
|||
[JsonProperty("button-style")]
|
||||
public ButtonType buttonStyle;
|
||||
|
||||
// If this question is on a selector, give it this placeholder.
|
||||
[JsonProperty("selector-placeholder")]
|
||||
public string selectorPlaceholder;
|
||||
|
||||
// The maximum length of a text input.
|
||||
[JsonProperty("max-length")]
|
||||
public int maxLength;
|
||||
|
||||
// The minimum length of a text input.
|
||||
[JsonProperty("min-length", Required = Required.Default)]
|
||||
public int minLength;
|
||||
|
||||
|
@ -220,6 +225,9 @@ public static class Interviewer
|
|||
[JsonProperty("button-style", Required = Required.Default)]
|
||||
public ButtonType buttonStyle;
|
||||
|
||||
[JsonProperty("selector-placeholder", Required = Required.Default)]
|
||||
public string selectorPlaceholder;
|
||||
|
||||
[JsonProperty("max-length", Required = Required.Default)]
|
||||
public int maxLength;
|
||||
|
||||
|
@ -603,8 +611,8 @@ public static class Interviewer
|
|||
|
||||
private static async Task CreateQuestion(DiscordChannel channel, InterviewQuestion question)
|
||||
{
|
||||
DiscordMessageBuilder msgBuilder = new DiscordMessageBuilder();
|
||||
DiscordEmbedBuilder embed = new DiscordEmbedBuilder()
|
||||
DiscordMessageBuilder msgBuilder = new();
|
||||
DiscordEmbedBuilder embed = new()
|
||||
{
|
||||
Color = Utilities.StringToColor(question.color),
|
||||
Title = question.title,
|
||||
|
@ -637,22 +645,28 @@ public static class Interviewer
|
|||
{
|
||||
categoryOptions.Add(new DiscordSelectComponentOption(question.paths.ToArray()[selectionOptions].Key, selectionOptions.ToString()));
|
||||
}
|
||||
selectionComponents.Add(new DiscordSelectComponent("supportchild_interviewselector " + selectionBoxes, "Select an option...", categoryOptions));
|
||||
|
||||
selectionComponents.Add(new DiscordSelectComponent("supportchild_interviewselector " + selectionBoxes, string.IsNullOrWhiteSpace(question.selectorPlaceholder)
|
||||
? "Select an option..." : question.selectorPlaceholder, categoryOptions));
|
||||
}
|
||||
|
||||
msgBuilder.AddComponents(selectionComponents);
|
||||
break;
|
||||
case QuestionType.ROLE_SELECTOR:
|
||||
msgBuilder.AddComponents(new DiscordRoleSelectComponent("supportchild_interviewroleselector", "Select a role..."));
|
||||
msgBuilder.AddComponents(new DiscordRoleSelectComponent("supportchild_interviewroleselector", string.IsNullOrWhiteSpace(question.selectorPlaceholder)
|
||||
? "Select a role..." : question.selectorPlaceholder));
|
||||
break;
|
||||
case QuestionType.USER_SELECTOR:
|
||||
msgBuilder.AddComponents(new DiscordUserSelectComponent("supportchild_interviewuserselector", "Select a user..."));
|
||||
msgBuilder.AddComponents(new DiscordUserSelectComponent("supportchild_interviewuserselector", string.IsNullOrWhiteSpace(question.selectorPlaceholder)
|
||||
? "Select a user..." : question.selectorPlaceholder));
|
||||
break;
|
||||
case QuestionType.CHANNEL_SELECTOR:
|
||||
msgBuilder.AddComponents(new DiscordChannelSelectComponent("supportchild_interviewchannelselector", "Select a channel..."));
|
||||
msgBuilder.AddComponents(new DiscordChannelSelectComponent("supportchild_interviewchannelselector", string.IsNullOrWhiteSpace(question.selectorPlaceholder)
|
||||
? "Select a channel..." : question.selectorPlaceholder));
|
||||
break;
|
||||
case QuestionType.MENTIONABLE_SELECTOR:
|
||||
msgBuilder.AddComponents(new DiscordMentionableSelectComponent("supportchild_interviewmentionableselector", "Select a mentionable..."));
|
||||
msgBuilder.AddComponents(new DiscordMentionableSelectComponent("supportchild_interviewmentionableselector", string.IsNullOrWhiteSpace(question.selectorPlaceholder)
|
||||
? "Select a user or role..." : question.selectorPlaceholder));
|
||||
break;
|
||||
case QuestionType.TEXT_INPUT:
|
||||
embed.WithFooter("Reply to this message with your answer. You cannot include images or files.");
|
||||
|
|
Loading…
Reference in a new issue