Compare commits

...

3 Commits

Author SHA1 Message Date
Shwoomple 01d023a2bf completing merge 2022-02-21 00:00:42 +05:30
Shwoomple bd9eae58cd commit for merge 2022-02-20 23:59:54 +05:30
BodgeMaster 461fbab6f0 make ping command reflect startup time 2022-02-20 19:15:44 +01:00
2 changed files with 21 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];
@ -23,7 +26,7 @@ public class Main {
// 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);
}
});
@ -32,6 +35,7 @@ public class Main {
}
//Deploy check thread
public static class CheckDeploy extends Thread {
private int interval;
private String id;

View File

@ -2,6 +2,7 @@ package linux.general.hackyquizbot;
import org.javacord.api.DiscordApi;
import org.javacord.api.entity.user.User;
import org.javacord.api.entity.message.embed.EmbedBuilder;
public class Member {
private DiscordApi api;
@ -14,10 +15,23 @@ public class Member {
if(event.getMessageContent().equalsIgnoreCase("!trivia")) {
if(event.getMessageAuthor().asUser().isPresent()) {
this.user = event.getMessageAuthor().asUser().get();
this.user.sendMessage("Welcome to hell");
this.user.sendMessage("Hi! I'm Hacky! **Fuck you**! :D");
}
}
});
}
public void sendMessage(String question, String[] options) {
String desc = new String();
for(String option: options) {
desc += option + "\n";
}
EmbedBuilder embed = new EmbedBuilder()
.setTitle(question)
.setDescription(desc);
this.user.sendMessage(embed);
}
}