Compare commits
	
		
			No commits in common. "4d04523cfe177e4247d8bd0b4d953070f7118647" and "95b38a39ddbec16388d60d2e31272629f56698cd" have entirely different histories. 
		
	
	
		
			4d04523cfe
			...
			95b38a39dd
		
	
		|  | @ -20,34 +20,30 @@ public class QuizHandler { | |||
| 				Message message = user.sendMessage("Hi! I'm Hacky.\n" | ||||
| 						+ "I will be sending you a bunch of multiple-choice questions. " | ||||
| 						+ "You can answer by selecting one or more of the reactions on the message and confirm your selection by selecting the :white_check_mark: reaction." | ||||
| 						+ " Please contact @BodgeMaster#0344 if there are any issues.\n\n" | ||||
| 						+ " Please contact @BodgeMaster#0344 if there are any issues.\n" | ||||
| 						+ "\n" | ||||
| 						+ "Select the :white_check_mark: reaction to continue.").get(); | ||||
| 				message.addReaction(EmojiParser.parseToUnicode(":white_check_mark:")); | ||||
| 				message.addReactionAddListener(event -> { | ||||
| 					// HACK: Testing for an exception to find out whether the event was caused by a
 | ||||
| 					// user or by the bot itself because reactions added by the bot allow to check
 | ||||
| 					// for user where reactions added by actual users don’t.
 | ||||
| 					try { | ||||
| 						if (!event.getUser().get().isYourself() && event.getReaction().get().getEmoji() | ||||
| 								.equalsEmoji(EmojiParser.parseToUnicode(":white_check_mark:"))) { | ||||
| 							event.getMessage().get().getChannel().sendMessage( | ||||
| 									"This should not work. If you ever see this message, please inform @BodgeMaster#0344 that there is more to this arbitrary limitation in the Discord API than expected."); | ||||
| 						} | ||||
| 					} catch (Exception e) { | ||||
| 						System.err.println("Assuming the reaction event was caused by the user..."); | ||||
| 						System.err.println("User ID: "+this.user.getIdAsString()); //test if we can get the user ID that way
 | ||||
| 					System.err.println("We get to here. #1"); | ||||
| 					User test = event.getUser().get(); //test to see if this throws an exception
 | ||||
| 					System.err.println("We get to here. #2"); | ||||
| 					System.err.println("Got an event from "+Long.toString(event.getUser().get().getId())); //this throws an exception - why?
 | ||||
| 					System.err.println("We get to here. #3"); | ||||
| 					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
 | ||||
| 					} | ||||
| 					// TODO: trigger question dispatch
 | ||||
| 					// TODO: remove ReactionAddListener
 | ||||
| 				}); | ||||
| 			} catch (InterruptedException | ExecutionException e) { | ||||
| 				// TODO Auto-generated catch block
 | ||||
| 				System.err.println("Something went wrong while trying to get the sent message object."); | ||||
| 				e.printStackTrace(); | ||||
| 			} | ||||
| 			// TODO: add white question mark reaction
 | ||||
| 			//TODO: add white question mark reaction
 | ||||
| 			 | ||||
| 			// TODO: add reaction handler (preferably to channel?)
 | ||||
| 			//TODO: add reaction handler (preferably to channel?)
 | ||||
| 		} else { | ||||
| 			user.sendMessage( | ||||
| 					"You have already had the maximum amount of questions that you can get with the current question set."); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue