Compare commits
4 Commits
81ffecec6a
...
76ad2e0adc
Author | SHA1 | Date |
---|---|---|
BodgeMaster | 76ad2e0adc | |
BodgeMaster | 88014c726d | |
BodgeMaster | 461fbab6f0 | |
Shwoomple | 92f66779c1 |
|
@ -4,11 +4,14 @@ import org.javacord.api.DiscordApi;
|
|||
import org.javacord.api.DiscordApiBuilder;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Date;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Main {
|
||||
|
||||
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
|
||||
String token = args[0];
|
||||
|
||||
|
@ -16,11 +19,14 @@ public class Main {
|
|||
check.start();
|
||||
|
||||
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"
|
||||
api.addMessageCreateListener(event -> {
|
||||
if (event.getMessageContent().equalsIgnoreCase("!ping")) {
|
||||
event.getChannel().sendMessage("Pong!");
|
||||
event.getChannel().sendMessage("Pong!\nHacky the quiz bot has been running since "+startupTime);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
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,12 +15,19 @@ public class QuizBackend {
|
|||
}
|
||||
|
||||
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
|
||||
* @return the full question text including multiple choice options with letters that correspond to getValidResponses()
|
||||
*/
|
||||
public String getQuestionTextWithOptions() {
|
||||
return null;
|
||||
|
@ -32,6 +39,10 @@ public class QuizBackend {
|
|||
public char[] getValidResponses() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public char[] getCorrectResponses() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is used to send the user’s reply back to the backend. Can be called
|
||||
|
|
Loading…
Reference in New Issue