trying to figure out while checking for "isYourself" doesn’t work

master
BodgeMaster 2022-02-22 20:26:12 +01:00
parent 9590e717bb
commit 41c7dc2831
2 changed files with 9 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import java.util.Scanner;
public class Main {
public static final String startupTime = String.format("%1$tY-%1$tm-%1$td %1$tI:%1$tM:%1$tS%1$tp UTC%1$tz", new Date());
private static String[] commandLineArguments;
private static long userID;
public static void main(String[] args) {
@ -25,6 +26,8 @@ public class Main {
QuizBackend backend = new QuizBackend();
DiscordApi api = new DiscordApiBuilder().setToken(commandLineArguments[0]).login().join();
userID = api.getYourself().getId();
System.err.println("Logging in as "+api.getYourself().getDiscriminatedName());
//user management
ArrayList<QuizHandler> QuizHandlers = new ArrayList<QuizHandler>();
@ -44,6 +47,10 @@ public class Main {
public static String getCommandLineArgument(int index) {
return commandLineArguments[index];
}
public static long getUserID() {
return userID;
}
//Deploy check thread
public static class CheckDeploy extends Thread {

View File

@ -25,7 +25,8 @@ public class QuizHandler {
+ "Select the :white_check_mark: reaction to continue.").get();
message.addReaction(EmojiParser.parseToUnicode(":white_check_mark:"));
message.addReactionAddListener(event -> {
if (!event.getUser().get().isYourself() && event.getReaction().get().getEmoji().equalsEmoji(EmojiParser.parseToUnicode(":white_check_mark:"))) {
System.err.println("Got an event from "+Long.toString(event.getUser().get().getId()));
if (event.getUser().get().getId()!=Main.getUserID() && event.getReaction().get().getEmoji().equalsEmoji(EmojiParser.parseToUnicode(":white_check_mark:"))) {
event.getMessage().get().getChannel().sendMessage("test");
//TODO: trigger question dispatch
//TODO: remove ReactionAddListener