Compare commits
3 Commits
113323da00
...
3f36573c19
Author | SHA1 | Date |
---|---|---|
BodgeMaster | 3f36573c19 | |
BodgeMaster | e885b18cc5 | |
BodgeMaster | 0de1cf9a67 |
|
@ -35,7 +35,7 @@ public class Main {
|
||||||
event.getChannel().sendMessage("Pong!\nHacky the quiz bot has been running since "+startupTime);
|
event.getChannel().sendMessage("Pong!\nHacky the quiz bot has been running since "+startupTime);
|
||||||
}
|
}
|
||||||
if (event.getMessageContent().equalsIgnoreCase("!trivia")) {
|
if (event.getMessageContent().equalsIgnoreCase("!trivia")) {
|
||||||
QuizHandlers.add(new QuizHandler(api, event.getMessageAuthor().asUser().get()));
|
QuizHandlers.add(new QuizHandler(event.getMessageAuthor().asUser().get()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,9 @@ public class QuizBackend {
|
||||||
//TODO: user aware random question picker
|
//TODO: user aware random question picker
|
||||||
|
|
||||||
//TODO: function to determine whether a user should get more questions
|
//TODO: function to determine whether a user should get more questions
|
||||||
|
public static boolean shouldGetMoreQuestions(String discordUserID) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: function to get a user’s score
|
//TODO: function to get a user’s score
|
||||||
|
|
||||||
|
|
|
@ -1,31 +1,28 @@
|
||||||
package linux.general.hackyquizbot;
|
package linux.general.hackyquizbot;
|
||||||
|
|
||||||
import org.javacord.api.DiscordApi;
|
|
||||||
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 DiscordApi api;
|
|
||||||
private User user;
|
private User user;
|
||||||
|
private Question lastQuestion;
|
||||||
public QuizHandler(DiscordApi api, User user) {
|
|
||||||
this.api = api;
|
public QuizHandler(User user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
user.sendMessage("Hi! I’m Hacky.\nThis is a test.");
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue