handle per-user question contingent

master
BodgeMaster 2022-02-22 18:50:34 +01:00
parent e885b18cc5
commit 3f36573c19
1 changed files with 17 additions and 17 deletions

View File

@ -1,28 +1,28 @@
package linux.general.hackyquizbot; package linux.general.hackyquizbot;
import org.javacord.api.entity.user.User; 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 { public class QuizHandler {
private User user; private User user;
private Question lastQuestion;
public QuizHandler(User user) { public QuizHandler(User user) {
this.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."); if (QuizBackend.shouldGetMoreQuestions(user.getIdAsString())) {
} user.sendMessage("Hi! I'm Hacky.\n"
+ "I will be sending you a bunch of multiple-choice questions. "
public void sendMessage(String question, String[] options) { + "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."
String desc = new String(); + " Please contact @BodgeMaster#0344 if there are any issues.\n"
+ "\n"
for(String option: options) { + "Select the :white_check_mark: reaction to continue.");
desc += option + "\n"; //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);
} }
} }