Compare commits

...

4 Commits

Author SHA1 Message Date
BodgeMaster 76ad2e0adc updated API because of a stupid I did 2022-02-20 19:37:48 +01:00
BodgeMaster 88014c726d Merge branch 'master' into bodgemaster 2022-02-20 19:18:07 +01:00
BodgeMaster 461fbab6f0 make ping command reflect startup time 2022-02-20 19:15:44 +01:00
Shwoomple 92f66779c1 started work on Member class 2022-02-20 23:11:38 +05:30
3 changed files with 43 additions and 3 deletions

View File

@ -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);
}
});

View File

@ -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");
}
}
});
}
}

View File

@ -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 arent
*/
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 users reply back to the backend. Can be called