improved trivia add command

This commit is contained in:
nora 2021-01-21 21:34:22 +01:00
parent dac3b78f1c
commit d1f07f86b5
2 changed files with 21 additions and 16 deletions

View file

@ -0,0 +1 @@
[]

View file

@ -34,7 +34,7 @@ public class TriviaCommand extends Command {
TriviaQuestionData.dump(); TriviaQuestionData.dump();
reply(event, "dumped"); reply(event, "dumped");
} else if (args.startsWith("add")) { } else if (args.startsWith("add")) {
reply(event, "Enter the Question"); reply(event, "Enter the Question (Example: \"What is the name of Gons's father?\")");
new AddSection(event.getTextChannel().getIdLong(), event.getAuthor().getIdLong()); new AddSection(event.getTextChannel().getIdLong(), event.getAuthor().getIdLong());
} else { } else {
int arc = 0; int arc = 0;
@ -108,8 +108,9 @@ public class TriviaCommand extends Command {
private static class AddSection extends Section { private static class AddSection extends Section {
private int status = 0; private int status = 0;
private static final String[] messages = {"Enter all answers seperated by a ;", "Enter the correct answer index (starting at 0)", private static final String[] messages = {"Enter all answers seperated by a ; (Example: \"Ging;Mito;Gon\")",
"Enter the arc this question belongs to as a number (see " + Config.PREFIX + "help trivia for more info)"}; "Enter the correct answer index starting at 0 (Example: \"0\")",
"Enter the arc this question belongs to as a number (see " + Config.PREFIX + "help trivia for more info) (Example: \"0\")"};
private String[] answers = new String[4]; private String[] answers = new String[4];
private AddSection(long textChannelID, long userID) { private AddSection(long textChannelID, long userID) {
@ -118,6 +119,7 @@ public class TriviaCommand extends Command {
@Override @Override
public void messageReceived(MessageReceivedEvent event) { public void messageReceived(MessageReceivedEvent event) {
if(!event.getMessage().getContentRaw().startsWith(Config.PREFIX + "help")){
System.out.println(ConsoleColors.BLUE_BOLD + "[TriviaCommand.AddSection 121] Received Next Message: " System.out.println(ConsoleColors.BLUE_BOLD + "[TriviaCommand.AddSection 121] Received Next Message: "
+ event.getMessage().getContentRaw() + " status: " + status + ConsoleColors.RESET); + event.getMessage().getContentRaw() + " status: " + status + ConsoleColors.RESET);
answers[status] = event.getMessage().getContentRaw(); answers[status] = event.getMessage().getContentRaw();
@ -133,6 +135,8 @@ public class TriviaCommand extends Command {
reply(event, messages[status]); reply(event, messages[status]);
} }
status++; status++;
deleteMsg(event);
}
} }
} }
} }