Compare commits
No commits in common. "76ad2e0adc1e4eef87c1788d9db9dba94518f70c" and "81ffecec6add06e5a5bce5dad06144b10a85c731" have entirely different histories.
76ad2e0adc
...
81ffecec6a
|
@ -4,14 +4,11 @@ import org.javacord.api.DiscordApi;
|
||||||
import org.javacord.api.DiscordApiBuilder;
|
import org.javacord.api.DiscordApiBuilder;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String startupTime = String.format("%1$tY-%1$tm-%1$td %1$tI:%1$tM:%1$tS%1$tp UTC%1$tz", new Date());
|
|
||||||
|
|
||||||
// Insert your bot's token here
|
// Insert your bot's token here
|
||||||
String token = args[0];
|
String token = args[0];
|
||||||
|
|
||||||
|
@ -19,14 +16,11 @@ public class Main {
|
||||||
check.start();
|
check.start();
|
||||||
|
|
||||||
DiscordApi api = new DiscordApiBuilder().setToken(token).login().join();
|
DiscordApi api = new DiscordApiBuilder().setToken(token).login().join();
|
||||||
|
|
||||||
//Trivia management
|
|
||||||
Member member = new Member(api);
|
|
||||||
|
|
||||||
// Add a listener which answers with "Pong!" if someone writes "!ping"
|
// Add a listener which answers with "Pong!" if someone writes "!ping"
|
||||||
api.addMessageCreateListener(event -> {
|
api.addMessageCreateListener(event -> {
|
||||||
if (event.getMessageContent().equalsIgnoreCase("!ping")) {
|
if (event.getMessageContent().equalsIgnoreCase("!ping")) {
|
||||||
event.getChannel().sendMessage("Pong!\nHacky the quiz bot has been running since "+startupTime);
|
event.getChannel().sendMessage("Pong!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
package linux.general.hackyquizbot;
|
|
||||||
|
|
||||||
import org.javacord.api.DiscordApi;
|
|
||||||
import org.javacord.api.entity.user.User;
|
|
||||||
|
|
||||||
public class Member {
|
|
||||||
private DiscordApi api;
|
|
||||||
private User user;
|
|
||||||
|
|
||||||
public Member(DiscordApi api) {
|
|
||||||
this.api = api;
|
|
||||||
|
|
||||||
this.api.addMessageCreateListener(event ->{
|
|
||||||
if(event.getMessageContent().equalsIgnoreCase("!trivia")) {
|
|
||||||
if(event.getMessageAuthor().asUser().isPresent()) {
|
|
||||||
this.user = event.getMessageAuthor().asUser().get();
|
|
||||||
|
|
||||||
this.user.sendMessage("Welcome to hell");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -15,19 +15,12 @@ public class QuizBackend {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Question {
|
public static class Question {
|
||||||
|
public Question(String question, String[] answers) {
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param question The string for the question text
|
|
||||||
* @param answers The multiple choice answers
|
|
||||||
* @param mask A mask to be layed over answers to decide which answers are correct and which aren’t
|
|
||||||
*/
|
|
||||||
public Question(String question, String[] answers, boolean[] mask) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the full question text including multiple choice options with letters that correspond to getValidResponses()
|
* @return the full question text including multiple choice options
|
||||||
*/
|
*/
|
||||||
public String getQuestionTextWithOptions() {
|
public String getQuestionTextWithOptions() {
|
||||||
return null;
|
return null;
|
||||||
|
@ -39,10 +32,6 @@ public class QuizBackend {
|
||||||
public char[] getValidResponses() {
|
public char[] getValidResponses() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public char[] getCorrectResponses() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is used to send the user’s reply back to the backend. Can be called
|
* This is used to send the user’s reply back to the backend. Can be called
|
||||||
|
|
Loading…
Reference in New Issue