diff --git a/.gitignore b/.gitignore
index 5d91084..ad46e4e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ target\*
.idea/*
*.class
Secrets.java
+src\main\java\com\github\nilstrieb\cofig/Secrets.java
\ No newline at end of file
diff --git a/new_trivia_questions.json b/new_trivia_questions.json
deleted file mode 100644
index 0637a08..0000000
--- a/new_trivia_questions.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index ced75c0..b3e27ee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -34,5 +34,22 @@
+
+
+
+ maven-assembly-plugin
+
+
+
+ com.github.nilstrieb.core.Main
+
+
+
+ jar-with-dependencies
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/github/nilstrieb/commands/fun/trivia/TriviaCommand.java b/src/main/java/com/github/nilstrieb/commands/fun/trivia/TriviaCommand.java
index 3d9927a..35fa937 100644
--- a/src/main/java/com/github/nilstrieb/commands/fun/trivia/TriviaCommand.java
+++ b/src/main/java/com/github/nilstrieb/commands/fun/trivia/TriviaCommand.java
@@ -23,7 +23,7 @@ public class TriviaCommand extends Command {
4 Greed Island arc
5 Chimera Ant arc
6 Election arc
-
+
Add questions using `""" + Config.PREFIX + "trivia add`");
}
@@ -128,7 +128,14 @@ public class TriviaCommand extends Command {
@Override
public void messageReceived(MessageReceivedEvent event) {
- if (!event.getMessage().getContentRaw().startsWith(Config.PREFIX + "help")) {
+ if (event.getAuthor().getIdLong() == Config.NILS_ID && event.getMessage().getContentRaw().startsWith("debug")) {
+ answers[0] = "question";
+ answers[1] = "a;b;c;d";
+ answers[2] = "0";
+ answers[3] = "0";
+ new TriviaApproval(event, new TriviaQuestion(answers));
+ } else {
+
System.out.println(ConsoleColors.BLUE_BOLD + "[TriviaCommand.AddSection 121] Received Next Message: "
+ event.getMessage().getContentRaw() + " status: " + status + ConsoleColors.RESET);
answers[status] = event.getMessage().getContentRaw();
diff --git a/src/main/java/com/github/nilstrieb/core/Main.java b/src/main/java/com/github/nilstrieb/core/Main.java
index c9bde59..d58942f 100644
--- a/src/main/java/com/github/nilstrieb/core/Main.java
+++ b/src/main/java/com/github/nilstrieb/core/Main.java
@@ -13,12 +13,17 @@ import com.github.nilstrieb.listener.ChannelMessageListener;
import com.github.nilstrieb.listener.CommandListener;
import com.github.nilstrieb.listener.ReactionEventListener;
import com.github.nilstrieb.listener.StartUpListener;
+import com.github.nilstrieb.util.ConsoleColors;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.entities.Activity;
+import net.dv8tion.jda.api.entities.Guild;
+import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.utils.Compression;
import javax.security.auth.login.LoginException;
+import java.io.File;
+import java.util.Scanner;
public class Main {
@@ -31,6 +36,37 @@ public class Main {
JDA jda = builder.build();
setupCommands();
+
+/* Thread t = new Thread(() -> {
+ Scanner scanner = new Scanner(System.in);
+ String line = scanner.nextLine();
+ while (!line.equals("exit")) {
+ if (line.startsWith("send")) {
+ System.out.println("GuildID");
+ line = scanner.nextLine();
+ Guild guild = jda.getGuildById(line);
+ if (guild != null) {
+ System.out.println("TextChannelID");
+ line = scanner.nextLine();
+ TextChannel textChannel = guild.getTextChannelById(line);
+ if (textChannel != null) {
+ System.out.println("Message");
+ line = scanner.nextLine();
+ if (!line.equals("")) {
+ textChannel.sendMessage(line).queue();
+ }
+ }
+ }
+ } else if(line.startsWith("filetest")){
+ File f = new File("hallo.eric");
+ System.out.println(ConsoleColors.BLUE + "[TriviaQuestionData 80] File path " + f.getAbsolutePath() + ConsoleColors.RESET);
+ }
+
+ line = scanner.nextLine();
+ }
+ System.exit(0);
+ });
+ t.start();*/
}
private static void setupCommands() {
diff --git a/src/main/java/com/github/nilstrieb/util/trivia/TriviaQuestionData.java b/src/main/java/com/github/nilstrieb/util/trivia/TriviaQuestionData.java
index 5f100e9..ad13677 100644
--- a/src/main/java/com/github/nilstrieb/util/trivia/TriviaQuestionData.java
+++ b/src/main/java/com/github/nilstrieb/util/trivia/TriviaQuestionData.java
@@ -2,7 +2,6 @@ package com.github.nilstrieb.util.trivia;
import com.github.nilstrieb.util.ConsoleColors;
import com.google.gson.Gson;
-import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import java.io.*;
import java.util.ArrayList;
@@ -11,9 +10,10 @@ import java.util.Random;
public class TriviaQuestionData {
static List> questions = new ArrayList<>();
- private static final List newQuestions = new ArrayList<>();
private static final Random random = new Random();
+ private static final String JSON_PATH = "trivia_questions.json";
+
static {
questions.add(new ArrayList<>());
questions.add(new ArrayList<>());
@@ -22,28 +22,34 @@ public class TriviaQuestionData {
questions.add(new ArrayList<>());
questions.add(new ArrayList<>());
questions.add(new ArrayList<>());
+ System.out.println(ConsoleColors.BLUE + "[TriviaQuestionData 25] JSON File Path: " + new File(JSON_PATH + "hallo").getAbsolutePath() + ConsoleColors.RESET);
loadJSON();
}
private static void loadJSON() {
+
+ System.out.println();
+
StringBuilder json = new StringBuilder();
try (BufferedReader bufferedReader = new BufferedReader(
- new FileReader("trivia_questions.json"))) {
+ new FileReader(JSON_PATH))) {
String line = bufferedReader.readLine();
while (line != null) {
json.append(line);
line = bufferedReader.readLine();
}
+
+
+ Gson gson = new Gson();
+ TriviaQuestion[] array = gson.fromJson(json.toString(), TriviaQuestion[].class);
+
+ for (TriviaQuestion triviaQuestion : array) {
+ questions.get(triviaQuestion.getArc()).add(triviaQuestion);
+ }
} catch (IOException e) {
e.printStackTrace();
}
- Gson gson = new Gson();
- TriviaQuestion[] array = gson.fromJson(json.toString(), TriviaQuestion[].class);
-
- for (TriviaQuestion triviaQuestion : array) {
- questions.get(triviaQuestion.getArc()).add(triviaQuestion);
- }
}
private static void saveJSON(String path, TriviaQuestion[] array) {
@@ -77,7 +83,7 @@ public class TriviaQuestionData {
public static void add(TriviaQuestion triviaQuestion) {
questions.get(triviaQuestion.getArc()).add(triviaQuestion);
- saveJSONFromAll("trivia_questions.json");
+ saveJSONFromAll(JSON_PATH);
}
public static TriviaQuestion getQuestion(int toArc) {
diff --git a/trivia_questions.json b/trivia_questions.json
index f5147ea..9a5d353 100644
--- a/trivia_questions.json
+++ b/trivia_questions.json
@@ -1 +1 @@
-[{"question":"What\u0027s the name of Gons aunt?","answers":["Kite","Mito","Ging","Kurapika"],"correctAnswer":1,"arc":0},{"question":"Why does Leorio want money?","answers":["To become a doctor","To send it to e-girls","So that others don\u0027t get it","To buy large quantities of drugs"],"correctAnswer":0,"arc":0},{"question":"What was Gon\u0027s aim after Killua left him alone playing with the Chairman Netero?","answers":["Get the ball","Make Netero use his right hand","Make Netero use his left leg","Let Netero drop the ball"],"correctAnswer":1,"arc":0},{"question":"What did Tonpa mix into the drink?","answers":["Sleeping pills","Headache tabletsschla","Laxative","Rat poison"],"correctAnswer":2,"arc":0},{"question":"How many doors are there at the Testing Gate of the Zoldyck Family?","answers":["7","5","12","8"],"correctAnswer":0,"arc":1},{"question":"How many tons did Killua manage to move when he entered Kukooro Mountain","answers":["14","16","32","64"],"correctAnswer":1,"arc":1},{"question":"What did Kurapika bring to his fight with Uvo?","answers":["Shovel","Bomb","Gon"],"correctAnswer":0,"arc":3},{"question":"What is Bisky\u0027s true form?","answers":["Boy","Big Woman","Little Girl"],"correctAnswer":1,"arc":4},{"question":"How did Gon die on Greed Island?","answers":["He didn\u0027t die on Greed Island","Hisoka killed him with a card to the neck","He lost too muich blood when Genthru blew his arm of","He killed himself after Killuas death"],"correctAnswer":0,"arc":4},{"question":"What is Genthrus ability called?","answers":["Nuke","Massive Explosion","Little Flower"],"correctAnswer":2,"arc":4},{"question":"Where did Meruem die?","answers":["Volcano","In the desert with Netero","In the basement of the palace","In the womb of the queen"],"correctAnswer":2,"arc":5},{"question":"What is Pitou\u0027s full name?","answers":["Pitoue","Youpitou","Neferpitou","Pitorius"],"correctAnswer":2,"arc":5},{"question":"Who is Alluka?","answers":["Gon\u0027s sister","A Zodiac","The \u0027dark\u0027 side of Nanika","Killua\u0027s sister"],"correctAnswer":3,"arc":6},{"question":"Who won the election?","answers":["Gon","Pariston","Morel","Leorio"],"correctAnswer":1,"arc":6},{"question":"haha","answers":["never","immer"],"correctAnswer":1,"arc":6}]
+[{"question":"question","answers":["a","b","c","d"],"correctAnswer":0,"arc":0}]