I am trying to code a giveaway bot. I am having problems getting all Usernames of Users who reacted to the Giveaway Message that have been sent by the bot and store them in a Array
of Type String
.
JDA Discord - How to get all names of Users who reacted to a bot's message in an array
1.5k Views Asked by AudioBubble At
2
You can get the
Message
object of the message by getting the history of the channel its in and then get the message by id from the history.The
Message
object has agetReactions
method that returns a list of all reactions on a message, you can then iterate through the reactions and in turn then iterate thru all the users that reacted on the given reaction and save the name/id of each user who reacted into an array or list or data structure of your choice.