trying to figure out while checking for "isYourself" doesn’t work
parent
9590e717bb
commit
41c7dc2831
|
@ -11,6 +11,7 @@ import java.util.Scanner;
|
||||||
public class Main {
|
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());
|
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 String[] commandLineArguments;
|
||||||
|
private static long userID;
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -25,6 +26,8 @@ public class Main {
|
||||||
QuizBackend backend = new QuizBackend();
|
QuizBackend backend = new QuizBackend();
|
||||||
|
|
||||||
DiscordApi api = new DiscordApiBuilder().setToken(commandLineArguments[0]).login().join();
|
DiscordApi api = new DiscordApiBuilder().setToken(commandLineArguments[0]).login().join();
|
||||||
|
userID = api.getYourself().getId();
|
||||||
|
System.err.println("Logging in as "+api.getYourself().getDiscriminatedName());
|
||||||
|
|
||||||
//user management
|
//user management
|
||||||
ArrayList<QuizHandler> QuizHandlers = new ArrayList<QuizHandler>();
|
ArrayList<QuizHandler> QuizHandlers = new ArrayList<QuizHandler>();
|
||||||
|
@ -44,6 +47,10 @@ public class Main {
|
||||||
public static String getCommandLineArgument(int index) {
|
public static String getCommandLineArgument(int index) {
|
||||||
return commandLineArguments[index];
|
return commandLineArguments[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static long getUserID() {
|
||||||
|
return userID;
|
||||||
|
}
|
||||||
|
|
||||||
//Deploy check thread
|
//Deploy check thread
|
||||||
public static class CheckDeploy extends Thread {
|
public static class CheckDeploy extends Thread {
|
||||||
|
|
|
@ -25,7 +25,8 @@ public class QuizHandler {
|
||||||
+ "Select the :white_check_mark: reaction to continue.").get();
|
+ "Select the :white_check_mark: reaction to continue.").get();
|
||||||
message.addReaction(EmojiParser.parseToUnicode(":white_check_mark:"));
|
message.addReaction(EmojiParser.parseToUnicode(":white_check_mark:"));
|
||||||
message.addReactionAddListener(event -> {
|
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");
|
event.getMessage().get().getChannel().sendMessage("test");
|
||||||
//TODO: trigger question dispatch
|
//TODO: trigger question dispatch
|
||||||
//TODO: remove ReactionAddListener
|
//TODO: remove ReactionAddListener
|
||||||
|
|
Loading…
Reference in New Issue