Compare commits

..

No commits in common. "3f36573c194e63dc82c9e9a2aff0f7a8fa2f7680" and "113323da00ef5d931a85bd2c63d60cbb429809f0" have entirely different histories.

3 changed files with 23 additions and 23 deletions

View File

@ -35,7 +35,7 @@ public class Main {
event.getChannel().sendMessage("Pong!\nHacky the quiz bot has been running since "+startupTime);
}
if (event.getMessageContent().equalsIgnoreCase("!trivia")) {
QuizHandlers.add(new QuizHandler(event.getMessageAuthor().asUser().get()));
QuizHandlers.add(new QuizHandler(api, event.getMessageAuthor().asUser().get()));
}
});

View File

@ -61,9 +61,6 @@ public class QuizBackend {
//TODO: user aware random question picker
//TODO: function to determine whether a user should get more questions
public static boolean shouldGetMoreQuestions(String discordUserID) {
return false;
}
//TODO: function to get a users score

View File

@ -1,28 +1,31 @@
package linux.general.hackyquizbot;
import org.javacord.api.DiscordApi;
import org.javacord.api.entity.user.User;
import org.javacord.api.entity.message.embed.EmbedBuilder;
import linux.general.hackyquizbot.QuizBackend.Question;
//TODO: find a better name for this class
public class QuizHandler {
private DiscordApi api;
private User user;
private Question lastQuestion;
public QuizHandler(User user) {
public QuizHandler(DiscordApi api, User user) {
this.api = api;
this.user = user;
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.");
}
user.sendMessage("Hi! Im Hacky.\nThis is a test.");
}
public void sendMessage(String question, String[] options) {
String desc = new String();
for(String option: options) {
desc += option + "\n";
}
EmbedBuilder embed = new EmbedBuilder()
.setTitle(question)
.setDescription(desc);
this.user.sendMessage(embed);
}
}