From 3f36573c194e63dc82c9e9a2aff0f7a8fa2f7680 Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Tue, 22 Feb 2022 18:50:34 +0100 Subject: [PATCH] handle per-user question contingent --- .../general/hackyquizbot/QuizHandler.java | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/main/java/linux/general/hackyquizbot/QuizHandler.java b/src/main/java/linux/general/hackyquizbot/QuizHandler.java index 20978e4..e366e75 100644 --- a/src/main/java/linux/general/hackyquizbot/QuizHandler.java +++ b/src/main/java/linux/general/hackyquizbot/QuizHandler.java @@ -1,28 +1,28 @@ package linux.general.hackyquizbot; import org.javacord.api.entity.user.User; -import org.javacord.api.entity.message.embed.EmbedBuilder; -//TODO: find a better name for this class +import linux.general.hackyquizbot.QuizBackend.Question; + public class QuizHandler { private User user; - + private Question lastQuestion; + public QuizHandler(User user) { this.user = user; - user.sendMessage("Hi! I'm Hacky.\nI will be sending you a bunch of multiple-choice questions. You can answer by selecting one or more of the reactions on the message and confirm your selection by selecting the :white_check_mark: reaction. Please contact @BodgeMaster#0344 if there are any issues."); - } - - public void sendMessage(String question, String[] options) { - String desc = new String(); - - for(String option: options) { - desc += option + "\n"; + if (QuizBackend.shouldGetMoreQuestions(user.getIdAsString())) { + user.sendMessage("Hi! I'm Hacky.\n" + + "I will be sending you a bunch of multiple-choice questions. " + + "You can answer by selecting one or more of the reactions on the message and confirm your selection by selecting the :white_check_mark: reaction." + + " Please contact @BodgeMaster#0344 if there are any issues.\n" + + "\n" + + "Select the :white_check_mark: reaction to continue."); + //TODO: add white question mark reaction + //TODO: add reaction handler (preferably to channel?) + } else { + user.sendMessage( + "You have already had the maximum amount of questions that you can get with the current question set."); } - - EmbedBuilder embed = new EmbedBuilder() - .setTitle(question) - .setDescription(desc); - - this.user.sendMessage(embed); } + }