Adding/Removing and Getting Reactions (Discord)



Version: PhantomBot

So in the Discord API there are commands to add/remove and get reactions on a post:

I was looking into the Discord4J that PhantomBot uses and there is a DiscordHandler that handles the reactions from the Discord API:

Currently in PhantomBot’s there is nothing added (yet) about reactions:

My questions:

  1. Is there an easier way to implement this at the moment? (Besides going in and adding to solo; maybe I missed something :smiley: )

  2. Can we expect this to be added as a feature?
    1.1 If yes, time-frame? Nightly update? :slight_smile:

  3. How would you handle adding and getting reactions to certain messages? You would add them by message ID’s, but how would you get the message ID’s?

  1. More than likely it will require core changes as that is how we interact primarily with any Java API. There are some ways via Rhino to interact with the Java APIs, but, it depends upon how reactions is implemented and what is desired.

  2. We do not commit to time-frames. We typically consider up-votes as a guideline on what to look at implementing.

  3. Not sure, I would need to look at the code or another developer would have to comment.


Can I throw a thousand up-votes in that direction? :wink:

Are there any ways to directly interact with sx.blah.discord.util.DiscordHandler through Rhino?

That would be the simplest solution, otherwise I’m going to have to fire up DiscordUtil and add in some reaction functionality (but I still need to figure out how to keep track of message ID’s).

Biggest reason I want to enable reaction functionality is because you would be able to interact with PhantomBot solely based on clicking emojis next to its messages (this would make interactions x1000 better than anything else).


All Java classes can be interacted with via Rhino. It is a question of ease of use and if it makes sense to do so. You can see in the PhantomBot code that there are places where we call in Java classes and methods.

You may consider a thread-safe linked list for keeping track of message IDs and eventually popping items out of the list and keeping it to a certain size (storing all outgoing messages will just keep taking up memory).

I suppose if I was coding it, I would probably track outgoing messages from the Discord Handler in Java, and generate events to be processed that included the reaction along with any other data required to perform an action. I am assuming that not all output from the bot is worthy of a reaction, so that would have to be taken into consideration.


Thanks a ton for the tips!

I shall try to use that outline as a plan to get something going.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.