Reputation: 19
How can I check, which reaction was added to a message? I want to create a command (!roles) with some reaction and if you click on one, you get a role. I tried like this:
if(event.getReactionEmote().emote == ":salt:") {
Guild guild = event.getGuild();
guild.addRoleToMember(event.getMember(), guild.getRoleById("*ROLEID*")).queue();
}
But it does not work.
Upvotes: 1
Views: 675
Reputation: 842
Use event.getReactionEmote().getEmoji.equals("EMOTE")
where "EMOTE" equals the emoji you want.
You may use EmojiTerra to find the correct code for the emoji of your liking. (You can find it at "Emoji - Codes". Use the code for "Java, JavaScript & JSON".)
Example: The correct code for salt is \uD83E\uDDC2
.
Upvotes: 2