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;
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);
}
}