2929public final class CoolMessagesBoardManager extends MessageReceiverAdapter {
3030
3131 private static final Logger logger = LoggerFactory .getLogger (CoolMessagesBoardManager .class );
32- private static final Emoji REACT_EMOJI = Emoji . fromUnicode ( "🌟" ) ;
32+ private Emoji coolEmoji ;
3333 private final Predicate <String > boardChannelNamePredicate ;
3434 private final CoolMessagesBoardConfig config ;
3535
3636 public CoolMessagesBoardManager (Config config ) {
3737 this .config = config .getCoolMessagesConfig ();
38+ this .coolEmoji = Emoji .fromUnicode (this .config .reactionEmoji ());
3839
3940 boardChannelNamePredicate =
4041 Pattern .compile (this .config .boardChannelPattern ()).asMatchPredicate ();
@@ -44,7 +45,7 @@ public CoolMessagesBoardManager(Config config) {
4445 public void onMessageReactionAdd (MessageReactionAddEvent event ) {
4546 final MessageReaction messageReaction = event .getReaction ();
4647 int originalReactionsCount = messageReaction .hasCount () ? messageReaction .getCount () : 0 ;
47- boolean isCoolEmoji = messageReaction .getEmoji ().getName (). equals (REACT_EMOJI . getName () );
48+ boolean isCoolEmoji = messageReaction .getEmoji ().equals (coolEmoji );
4849 long guildId = event .getGuild ().getIdLong ();
4950 Optional <TextChannel > boardChannel = getBoardChannel (event .getJDA (), guildId );
5051
@@ -64,7 +65,7 @@ public void onMessageReactionAdd(MessageReactionAddEvent event) {
6465 final int newReactionsCount = originalReactionsCount + 1 ;
6566 if (isCoolEmoji && newReactionsCount >= config .minimumReactions ()) {
6667 event .retrieveMessage ().queue (message -> {
67- message .addReaction (REACT_EMOJI ).queue ();
68+ message .addReaction (coolEmoji ).queue ();
6869
6970 insertCoolMessage (boardChannel .get (), message );
7071 }, e -> logger .warn ("Tried to retrieve cool message but got: {}" , e .getMessage ()));
@@ -123,8 +124,8 @@ private static MessageEmbed createQuoteEmbed(Message message) {
123124 /**
124125 * Checks a {@link MessageReaction} to see if the bot has reacted to it.
125126 */
126- private static boolean hasBotReacted (JDA jda , MessageReaction messageReaction ) {
127- if (!REACT_EMOJI .equals (messageReaction .getEmoji ())) {
127+ private boolean hasBotReacted (JDA jda , MessageReaction messageReaction ) {
128+ if (!coolEmoji .equals (messageReaction .getEmoji ())) {
128129 return false ;
129130 }
130131
0 commit comments